Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to read WSDL File

807600Aug 16 2007 — edited Aug 17 2007
Hi all,
I am new in web services...just started yesterday.. my client is provinding web services...I just need to send some data to them and retrieve data back...they are basically verifying addresses..if Address is not corrent then they will send the correct one back..I have no clue which method should I call and how to send data to them..below is my work that I have done so far...please help me...
///Below is the Client API that I have made...there is a bean file which I have made for Input Data...

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
   
public class TestClient {
    public static void main(String [] args) {
       try {
         String endpoint = "http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress";
         Service  service = new Service();
         Call     call    = (Call) service.createCall();
  
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
        call.setOperationName(new QName("http://m3group101.mnao.net/", "ValidateAddress"));
	call.setUsername("free");
	call.setPassword("account");  	

	AddressIn addressIn  = new AddressIn();

        addressIn.Address1 = "6767 Friars Rd";

        addressIn.Address2 = "";

        addressIn.Address3 = "";

        addressIn.Address4 = "";

        addressIn.City = "SAN DIEGO";

        addressIn.StateProv = "CA";

        addressIn.PostalCode = "";
 
        addressIn.Country = "US";
 
        String ret = (String) call.invoke(new Object[] {"",""});      ////Here I donno what should I pass
  
        System.out.println("Sent DATA, got '" + ret + "'");
      } catch (Exception e) {
        System.err.println("Got Error While retrieving data "+e.toString());
      }
    }
}
///My Bean File Looks like this....

import java.io.*;
import java.util.*;
import java.util.ResourceBundle;

public class AddressIn {

    public String KeyValue;
    public String Address1;
    public String Address2;
    public String Address3;
    public String Address4;
    public String City;
    public String StateProv;
    public String PostalCode;
    public String Country;
    
    public AddressIn()
    {
    	KeyValue   = "";
    	Address1   = "";
    	Address2   = "";
    	Address3   = "";
    	Address4   = "";
    	City       = "";
    	StateProv  = "";
    	PostalCode = "";
    	Country    = "";
    } // END constructor
} // END class AddressIn




import java.io.*;
import java.util.*;
import java.util.ResourceBundle;

public class AddressOut {

    public String KeyValue;
    public String Address1;
    public String Address2;
    public String Address3;
    public String Address4;
    public String City;
    public String StateProv;
    public String PostalCodeBase;
    public String PostalCodeAddOn;
    public String Country;
    public String Status;
    public String StatusCode;
    public String StatusDescription;
    public String Confidence;
    public String RecordType;
    
    public AddressOut()
    {
    	KeyValue   = "";
    	Address1   = "";
    	Address2   = "";
    	Address3   = "";
    	Address4   = "";
    	City       = "";
    	StateProv  = "";
    	PostalCodeBase  = "";
    	PostalCodeAddOn = "";
    	Country    = "";
    	Status     = "";
    	StatusCode = "";
    	StatusDescription = "";
    	Confidence = "";
    	RecordType = "";
    } // END constructor
} // END class AddressIn
Please see the WSDL File...
<?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions targetNamespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns:intf="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://com.g1.dcg/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd00="http://www.w3.org/2000/10/XMLSchema" xmlns:xsd99="http://www.w3.org/1999/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="ArrayOf_xsd_anyType">
- <complexContent>
- <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> 
  </restriction>
  </complexContent>
  </complexType>
- <complexType name="ArrayOf_tns1_ServiceOption">
- <complexContent>
- <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:ServiceOption[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> 
  </restriction>
  </complexContent>
  </complexType>
- <complexType name="ArrayOf_tns1_DataRow">
- <complexContent>
- <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:DataRow[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> 
  </restriction>
  </complexContent>
  </complexType>
- <complexType name="ArrayOf_xsd_string">
- <complexContent>
- <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" /> 
  </restriction>
  </complexContent>
  </complexType>
  </schema>
- <schema targetNamespace="http://com.g1.dcg/services" xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
- <complexType name="ServiceOption">
- <sequence>
  <element name="key" nillable="true" type="xsd:string" /> 
  <element name="value" nillable="true" type="xsd:string" /> 
  </sequence>
  </complexType>
- <complexType name="DataTableBean">
- <sequence>
  <element name="columnNames" nillable="false" type="impl:ArrayOf_xsd_string" /> 
  <element name="dataRows" nillable="true" type="impl:ArrayOf_tns1_DataRow" /> 
  </sequence>
  </complexType>
- <complexType name="DataRow">
- <sequence>
  <element name="values" nillable="true" type="impl:ArrayOf_xsd_string" /> 
  </sequence>
  </complexType>
  </schema>
  </wsdl:types>
- <wsdl:message name="processResponse">
  <wsdl:part name="arg0" type="tns1:DataTableBean" /> 
  </wsdl:message>
- <wsdl:message name="processRequest">
  <wsdl:part name="arg0" type="impl:ArrayOf_tns1_ServiceOption" /> 
  <wsdl:part name="arg1" type="tns1:DataTableBean" /> 
  </wsdl:message>
- <wsdl:portType name="G1Service">
- <wsdl:operation name="process" parameterOrder="arg0 arg1">
  <wsdl:input message="impl:processRequest" name="processRequest" /> 
  <wsdl:output message="impl:processResponse" name="processResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="ValidateAddressSoapBinding" type="impl:G1Service">
  <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="process">
  <wsdlsoap:operation soapAction="ValidateAddress" /> 
- <wsdl:input name="processRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" use="encoded" /> 
  </wsdl:input>
- <wsdl:output name="processResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="ValidateAddress">
- <wsdl:port binding="impl:ValidateAddressSoapBinding" name="ValidateAddress">
  <wsdlsoap:address location="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
I am receiving Exception " No Such Operation "
I am sorry but I don'n know how to read WSDL file...


thanks

Vish...

Message was edited by:
vishu007
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2007
Added on Aug 16 2007
1 comment
1,180 views