You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by thusa gihan <th...@gmail.com> on 2008/10/09 08:15:42 UTC

Altering WSDL to match the expected SOAP

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">myemail@domain.com</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">myemail@mydomain.com
</value>
                     </item>
                  </item>
               </args>
            </ns1:call>
         </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
 --------------------------------------------------------------

Re: Altering WSDL to match the expected SOAP

Posted by thusa gihan <th...@gmail.com>.
Hi Martin,

With your changes I tried using Axis 1.4, now the client fails saying "
faultString: Procedure 'username' not present".

Not sure whether I applied your changes correctly. I have attached the
current WSDL below.

Thanks,
Thusa.

(new wsdl)
-----------------------------------------------
<?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 transport="http://schemas.xmlsoap.org/soap/http"
   style="document" />
  <!-- I have no idea what this is used for -->
  <!-- soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/<http://schemas.xmlsoap.org/soap/http%22/<http://schemas.xmlsoap.org/soap/http%22/%3Chttp://schemas.xmlsoap.org/soap/http%22/>-->
  <operation name="call">
   <soap:operation
    soapAction="urn:Comp_Api_Model_Server_HandlerAction" />
   <input>
    <soap:body
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     namespace="http://types.echo.services" use="literal" />
    <!-- I have no idea what this used for -->
    <!-- soap:body namespace="urn:Company" use="encoded" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/<http://schemas.xmlsoap.org/soap/encoding/%22/<http://schemas.xmlsoap.org/soap/encoding/%22/%3Chttp://schemas.xmlsoap.org/soap/encoding/%22/>>>
-->
   </input>
   <output>
    <soap:body namespace="urn:Company" use="encoded"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    <!--no idea what this used for -->
    <!-- soap:body namespace="urn:Company" use="encoded" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/<http://schemas.xmlsoap.org/soap/encoding/%22/<http://schemas.xmlsoap.org/soap/encoding/%22/%3Chttp://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"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     use="literal" />
    <!-- i have no idea what this is used for -->
    <!-- soap:body namespace="urn:Company" use="encoded" encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/<http://schemas.xmlsoap.org/soap/encoding/%22/<http://schemas.xmlsoap.org/soap/encoding/%22/%3Chttp://schemas.xmlsoap.org/soap/encoding/%22/>>>
-->
   </input>
   <output>
    <soap:body namespace="urn:Company"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
     use="literal" />
    <!-- I have no idea what this is used for -->
   </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/" />
  </port>
 </service>
</definitions>

---------------------------------------------------------------------



On Fri, Oct 10, 2008 at 6:17 AM, Martin Gainty <mg...@hotmail.com> wrote:

> the wsdl you were using was
> not well-formed and
> supported rpc instead of document-literal style
> here is a corrected version
>
>
> <?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 transport="http://schemas.xmlsoap.org/soap/http"
> style="document" />
>
> <!-- I have no idea what this is used for -->
>      <!-- soap:binding style="document" 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 encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/" namespace="
> http://types.echo.services" use="literal"/>
>          <!-- I have no idea what this used for -->
>          <!-- 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/" />
>          <!--no idea what this used for -->
>          <!-- 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" encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
>          <!-- i have no idea what this is used for -->
>          <!-- 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" encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
>          <!-- I have no idea what this is used for -->
>        </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/" />
>      </port>
>    </service>
>  </definitions>
>
> HTH
> Martin
> ______________________________________________
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and Sender
> does not endorse distribution to any party other than intended recipient.
> Sender does not necessarily endorse content contained within this
> transmission.
>
>
> > Date: Thu, 9 Oct 2008 16:53:39 -0700
> > From: donny.tjondra@verizonwireless.com
> > To: axis-user@ws.apache.org
> > Subject: Re: Altering WSDL to match the expected SOAP
>
> >
> >
> > 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">myemail@domain.com</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">myemail@mydomain.com
> > > </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: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
>
> ------------------------------
> Get more out of the Web. Learn 10 hidden secrets of Windows Live. Learn
> Now<http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_getmore_092008>
>

RE: Altering WSDL to match the expected SOAP

Posted by Martin Gainty <mg...@hotmail.com>.
the wsdl you were using was 
not well-formed and 
supported rpc instead of document-literal style
here is a corrected version

<?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 transport="http://schemas.xmlsoap.org/soap/http" style="document" />
            
<!-- I have no idea what this is used for -->            
     <!-- soap:binding style="document" 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 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://types.echo.services" use="literal"/>                     
         <!-- I have no idea what this used for -->
         <!-- 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/" />
         <!--no idea what this used for -->
         <!-- 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" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>
         <!-- i have no idea what this is used for -->
         <!-- 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" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="literal"/>       
         <!-- I have no idea what this is used for -->
       </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/" />       
     </port>
   </service>
 </definitions>

HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Thu, 9 Oct 2008 16:53:39 -0700
> From: donny.tjondra@verizonwireless.com
> To: axis-user@ws.apache.org
> Subject: Re: Altering WSDL to match the expected SOAP
> 
> 
> 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">myemail@domain.com</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">myemail@mydomain.com
> > </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: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008

Re: Altering WSDL to match the expected SOAP

Posted by thusa gihan <th...@gmail.com>.
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">myemail@mydomain.com
</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@domail.com");

---------------------------------------------------------------------------------------------------------------

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 <do...@verizonwireless.com>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">myemail@domain.com
> </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">
> myemail@mydomain.com
> > </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: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Altering WSDL to match the expected SOAP

Posted by don t <do...@verizonwireless.com>.
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">myemail@domain.com</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">myemail@mydomain.com
> </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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org