Loading ...
Sorry, an error occurred while loading the content.

strange generated request when consuming WSDL file

Expand Messages
  • Alceu R
    Greetings, I have an doubt about the request being automatically generated by SOAP::Lite. Here is (part) of the WSDL file content. Please note that are two
    Message 1 of 1 , May 11, 2011
    View Source
    • 0 Attachment
      Greetings,

      I have an doubt about the request being automatically generated by SOAP::Lite.

      Here is (part) of the WSDL file content. Please note that are two complex types defined, one being the request and the other the response.

      <types>
      <xsd:schema targetNamespace="http://saomc11024412/SiebelPhysician/SiebelPhysician.xsd">
      <xsd:complexType name="FindByRCNRequest">
      <xsd:sequence>
      <xsd:element name="federativeUnity" type="xsd:string"/>
      <xsd:element name="regionalConcilNumber" type="xsd:int"/>
      </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="FindByRCNResponse">
      <xsd:sequence>
      <xsd:element name="firstName" type="xsd:string"/>
      <xsd:element name="lastName" type="xsd:string"/>
      <xsd:element name="type" type="xsd:string"/>
      <xsd:element name="status" type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
      </types>

      When consuming that with the minimum code below:

      print SOAP::Lite->service('http://localhost/SiebelSOAP/SiebelPhysician.xsd')->FindByRCN('PR', 11778);

      I got the following SOAP request:

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:tns="SiebelPhysician"
      xmlns:xsdl="http://saomc11024412/SiebelPhysician/SiebelPhysician.xsd"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
      <tns:FindByRCN>
      <c-gensym3 xsi:type="xsd:string">PR</c-gensym3>
      <c-gensym5 xsi:type="xsd:int">11778</c-gensym5>
      </tns:FindByRCN>
      </soap:Body>
      </soap:Envelope>

      I was expecting to have inside the soap:Body the element FindByRCNRequest and not the method name. Trying to use SOAP::Data to generate the request as defined in the WSDL file does not help:

      my $val1 = SOAP::Data->type('string')->name('federativeUnity')->value('PR');
      my $val2 =
      SOAP::Data->type('integer')->name('regionalConcilNumber')->value(11778);

      my $request_data =
      SOAP::Data->type('complex')->name('FindByRCNRequest')->value( $val1, $val2 );

      print SOAP::Lite->service('http://localhost/SiebelSOAP/SiebelPhysician.xsd')
      ->FindByRCN($request_data);


      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:tns="SiebelPhysician"
      xmlns:xsdl="http://saomc11024412/SiebelPhysician/SiebelPhysician.xsd"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
      <tns:FindByRCN>
      <federativeUnity xsi:type="xsd:string">PR</federativeUnity>
      <regionalConcilNumber xsi:type="xsd:integer">11778</regionalConcilNumber>
      </tns:FindByRCN>
      </soap:Body>
      </soap:Envelope>

      In the other hand, the response of the server is being exactly as defined in the WSDL file:

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <FindByRCNResponse xmlns="SiebelPhysician">
      <firstName xsi:type="xsd:string">CARLOS</firstName>
      <lastName xsi:type="xsd:string">ALBERTO DE CASTRO</lastName>
      <type xsi:type="xsd:string">MEDICO</type>
      <status xsi:type="xsd:string">ATIVO</status>
      </FindByRCNResponse>
      </soap:Body>
      </soap:Envelope>


      Here is the code of the server:

      return SOAP::Data->name('physicianData')->type('complex')->value(
      SOAP::Data->name('firstName')->type('string')
      ->value( $phy->fst_name() ),
      SOAP::Data->name('lastName')->type('string')
      ->value( $phy->last_name() ),
      SOAP::Data->name('type')->type('string')->value( $phy->type() ),
      SOAP::Data->name('status')->type('string')->value( $phy->status()->value() ),
      )->uri($uri);

      Am I doing something wrong? Or this behaviour is expected?

      Thanks,
      Alceu

      Ps: below is the complete WSDL for reference

      <?xml version="1.0"?>
      <definitions name="SiebelPhysicians" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="SiebelPhysician" xmlns:tns="SiebelPhysician" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsdl="http://saomc11024412/SiebelPhysician/SiebelPhysician.xsd">
      <types>
      <xsd:schema targetNamespace="http://saomc11024412/SiebelPhysician/SiebelPhysician.xsd">
      <xsd:complexType name="FindByRCNRequest">
      <xsd:sequence>
      <xsd:element name="federativeUnity" type="xsd:string"/>
      <xsd:element name="regionalConcilNumber" type="xsd:int"/>
      </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="FindByRCNResponse">
      <xsd:sequence>
      <xsd:element name="firstName" type="xsd:string"/>
      <xsd:element name="lastName" type="xsd:string"/>
      <xsd:element name="type" type="xsd:string"/>
      <xsd:element name="status" type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:schema>
      </types>
      <message name="FindByRCNRequest">
      <part name="FindByRCNRequestSoapMsg" element="xsdl:FindByRCNRequest"/>
      </message>
      <message name="FindByRCNResponse">
      <part name="FindByRCNResponseSoapMsg" element="xsdl:FindByRCNResponse"/>
      </message>
      <portType name="SiebelPhysician_PortType">
      <operation name="FindByRCN">
      <input message="tns:FindByRCNRequest" />
      <output message="tns:FindByRCNResponse" />
      </operation>
      </portType>
      <binding name="SiebelPhysicianBinding" type="tns:SiebelPhysician_PortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="FindByRCN">
      <soap:operation style="document" soapAction=""/>
      <input>
      <soap:body use="literal"/>
      </input>
      <output>
      <soap:body use="literal"/>
      </output>
      </operation>
      </binding>
      <service name="SiebelPhysician">
      <documentation>SOAP service to query physicians in Siebel database</documentation>
      <port name="SiebelPhysician_PortType" binding="tns:SiebelPhysicianBinding">
      <soap:address location="http://saomc11024412/cgi-bin/siebel-soap.pl"/>
      </port>
      </service>
      </definitions>
    Your message has been successfully submitted and would be delivered to recipients shortly.