Thanks for the reply.
I understand, but I'm unable to get the web service call working. That's why
I thought of trying to edit the WSDL.
I'm trying to execute the call() method of this service. It has a parameter
named args (Object type); and not sure how to set a Java object for this
param to generate the following SOAP (it is the one expected by the server).
---------------------------------------------------------------------------------------------------------------
<args SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">firstname</key>
<value xsi:type="xsd:string">myFirstName</value>
</item>
<item>
<key xsi:type="xsd:string">lastname</key>
<value xsi:type="xsd:string">myLastName</value>
</item>
<item>
<key xsi:type="xsd:string">email</key>
<value xsi:type="xsd:string">[EMAIL PROTECTED]
</value>
</item>
</item>
</args>
---------------------------------------------------------------------------------------------------------------
Above is the SOAP part that I'm unable to generate with Java client.
I tried to use a Map, but it does not successfully generate above SOAP part.
---------------------------------------------------------------------------------------------------------------
Map<String, String> customer = new HashMap<String, String>();
customer.put("firstname", "FName");
customer.put("lastname", "LName");
customer.put("email", "[EMAIL PROTECTED]");
---------------------------------------------------------------------------------------------------------------
If I send a java.util.Map object to the args argument of this method call as
above, it return an error saying;
"faultString: SOAP-ERROR: Encoding: Can't decode apache map, only Strings or
Longs are allowd as keys".
Please help me to generate the correct Java object to get the matching SOAP
request.
Thanks a lot.
Thusa
On Fri, Oct 10, 2008 at 5:23 AM, don t <[EMAIL PROTECTED]>wrote:
>
> Hi, the standard practice for a web service client is to obtain the WSDL
> from
> the service provider and generate the stub from it. Editing the WSDL on the
> client side is problematic and causes errors.
>
>
>
> thusa gihan wrote:
> >
> > Hi all,
> >
> > I'm writing a client with Axis 1.4 to a web service, but the generated
> > SOAP
> > request is not matching with the one expected by the web service.
> >
> > Could you please help me to edit the WSDL file (saved into my local disk
> > from the server) so that I can generate the stubs to build the expected
> > SOAP
> > requests. I have posted the WSDL, currently generated SOAP request and
> the
> > expected SOAP request below.
> >
> > If WSDL editing is not the way to get this done, please suggest me some
> > other way. I'm really stuck here.
> >
> > Thanks in advance.
> >
> > Thusa.
> >
> >
> >
> > This is the avaialble WSDL file.
> > --------------------------------------------------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <definitions xmlns:typens="urn:Company" xmlns:xsd="
> > http://www.w3.org/2001/XMLSchema" xmlns:soap="
> > http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="
> > http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="
> > http://schemas.xmlsoap.org/wsdl/" xmlns="
> http://schemas.xmlsoap.org/wsdl/"
> > name="Company" targetNamespace="urn:Company">
> > <message name="call">
> > <part name="sessionId" type="xsd:string"/>
> > <part name="resourcePath" type="xsd:string"/>
> > <part name="args" type="xsd:anyType"/>
> > </message>
> > <message name="callResponse">
> > <part name="callReturn" type="xsd:anyType"/>
> > </message>
> > <message name="login">
> > <part name="username" type="xsd:string"/>
> > <part name="apiKey" type="xsd:string"/>
> > </message>
> > <message name="loginResponse">
> > <part name="loginReturn" type="xsd:string"/>
> > </message>
> >
> > <portType name="Comp_Api_Model_Server_HandlerPortType">
> > <operation name="call">
> > <documentation>Call api functionality</documentation>
> > <input message="typens:call"/>
> > <output message="typens:callResponse"/>
> > </operation>
> > <operation name="login">
> > <documentation>Login user and retrive session id</documentation>
> > <input message="typens:login"/>
> > <output message="typens:loginResponse"/>
> > </operation>
> > </portType>
> >
> > <binding name="Comp_Api_Model_Server_HandlerBinding"
> > type="typens:Comp_Api_Model_Server_HandlerPortType">
> > <soap:binding style="rpc" transport="
> > http://schemas.xmlsoap.org/soap/http"/<
> http://schemas.xmlsoap.org/soap/http%22/>
> >>
> > <operation name="call">
> > <soap:operation
> > soapAction="urn:Comp_Api_Model_Server_HandlerAction"/>
> > <input>
> > <soap:body namespace="urn:Company" use="encoded" encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/"/<
> http://schemas.xmlsoap.org/soap/encoding/%22/>
> >>
> > </input>
> > <output>
> > <soap:body namespace="urn:Company" use="encoded" encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/"/<
> http://schemas.xmlsoap.org/soap/encoding/%22/>
> >>
> > </output>
> > </operation>
> > <operation name="login">
> > <soap:operation
> > soapAction="urn:Comp_Api_Model_Server_HandlerAction"/>
> > <input>
> > <soap:body namespace="urn:Company" use="encoded" encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/"/<
> http://schemas.xmlsoap.org/soap/encoding/%22/>
> >>
> > </input>
> > <output>
> > <soap:body namespace="urn:Company" use="encoded" encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/"/<
> http://schemas.xmlsoap.org/soap/encoding/%22/>
> >>
> > </output>
> > </operation>
> > </binding>
> > <service name="CompanyService">
> > <port name="Comp_Api_Model_Server_HandlerPort"
> > binding="typens:Comp_Api_Model_Server_HandlerBinding">
> > <soap:address location="
> > http://localhost/Company/index.php/api/index/index/"/<
> http://localhost/Company/index.php/api/index/index/%22/>
> >>
> > </port>
> > </service>
> > </definitions>
> > --------------------------------------------------------------
> >
> > Currently generated SOAP request is as follows.
> > --------------------------------------------------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope xmlns:soapenv="
> > http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
> > http://www.w3.org/2001/XMLSchema" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance">
> > <soapenv:Body>
> > <ns1:call soapenv:encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Company">
> > <sessionId
> > xsi:type="xsd:string">1vp029hcubiiven8cr1s21nke2</sessionId>
> > <resourcePath
> > xsi:type="xsd:string">customer.create</resourcePath>
> > <args soapenc:arrayType="xsd:anyType[1]"
> > xsi:type="soapenc:Array" xmlns:soapenc="
> > http://schemas.xmlsoap.org/soap/encoding/">
> > <args href="#id0"/>
> > </args>
> > </ns1:call>
> > <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Map"
> > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="
> > http://xml.apache.org/xml-soap">
> > <item>
> > <key xsi:type="soapenc:string">email</key>
> > <value xsi:type="soapenc:string">[EMAIL PROTECTED]
> </value>
> > </item>
> > <item>
> > <key xsi:type="soapenc:string">lastname</key>
> > <value xsi:type="soapenc:string">myLastName</value>
> > </item>
> > <item>
> > <key xsi:type="soapenc:string">firstname</key>
> > <value xsi:type="soapenc:string">MyFirstName</value>
> > </item>
> > </multiRef>
> > </soapenv:Body>
> > </soapenv:Envelope>
> > --------------------------------------------------------------
> >
> > But the server expects a SOAP request as follows. ( I found this SOAP
> > request from one of their sample clients done with PHP).
> > --------------------------------------------------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <SOAP-ENV:Envelope xmlns:SOAP-ENV="
> > http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Company"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="
> > http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="
> > http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="
> > http://schemas.xmlsoap.org/soap/encoding/">
> > <SOAP-ENV:Body>
> > <ns1:call>
> > <sessionId
> > xsi:type="xsd:string">mj3kj5rr2df0b1fq5kmputmr54</sessionId>
> > <resourcePath
> > xsi:type="xsd:string">customer.create</resourcePath>
> > <args SOAP-ENC:arrayType="ns2:Map[1]"
> > xsi:type="SOAP-ENC:Array">
> > <item xsi:type="ns2:Map">
> > <item>
> > <key xsi:type="xsd:string">firstname</key>
> > <value xsi:type="xsd:string">myFirstName</value>
> > </item>
> > <item>
> > <key xsi:type="xsd:string">lastname</key>
> > <value xsi:type="xsd:string">myLastName</value>
> > </item>
> > <item>
> > <key xsi:type="xsd:string">email</key>
> > <value xsi:type="xsd:string">
> [EMAIL PROTECTED]
> > </value>
> > </item>
> > </item>
> > </args>
> > </ns1:call>
> > </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> > --------------------------------------------------------------
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Altering-WSDL-to-match-the-expected-SOAP-tp19893021p19909571.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>