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

6578dispatch_with not working to map SOAPHeader with Perl method

Expand Messages
  • Alceu R
    May 13, 2011
    • 0 Attachment
      Greetings,

      I trying to use SOAPHeader with a document type webservice but I'm not being able to make the server to reply the request.

      I have the following (partial) WSDL being consumed by my SOAP::Lite client:

      <wsdl:binding name="SiebelPhysicianBinding" type="tns:SiebelPhysician_PortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="FindByRCN">
      <soap:operation soapAction="urn:SiebelPhysician#FindByRCN"/>
      <wsdl:input>
      <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
      <soap:body use="literal"/>
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="SiebelPhysician">
      <wsdl:port name="SiebelPhysician_PortType" binding="tns:SiebelPhysicianBinding">
      <wsdl:documentation>SOAP service to query physicians in Siebel database</wsdl:documentation>
      <soap:address location="http://saomc11024412/cgi-bin/siebel-soap.pl"/>
      </wsdl:port>
      </wsdl:service>

      The code of my client:

      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('request')->value( $val1, $val2 );

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

      This is the request of the client:

      SOAPAction: "urn:SiebelPhysician#FindByRCN"

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><FindByRCN xmlns=""><federativeUnity xsi:typ
      e="xsd:string">PR</federativeUnity><regionalConcilNumber xsi:type="xsd:integer">11778</regionalConcilNumber></FindByRCN></SOAP-ENV:Body></SOAP-ENV:Envelope>

      The client is fetching the SOAPAction header value from the WSDL. But I cannot use call() method with it because the SOAP::Lite complaing about the definition of proxy, which in fact is specified by the WSDL. BUT if I use the method (FindByRCN), SOAP::Lite does not complain but generates an XML entity that is incompatible with the definitions on the WSDL. >:-(

      This is not the big issue. The problem is the server answer:

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas
      .xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode xsi:type="xsd:str
      ing">SOAP-ENV:Client</faultcode><faultstring xsi:type="xsd:string">SOAPAction shall match 'uri#method' if present (got 'urn:SiebelPhysician#FindByRCN', expected '#FindByRCN'
      </faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

      Here is the (partial) code of the server:

      use SOAP::Transport::HTTP;
      use Regexp::Common qw(number);

      use warnings;
      use strict;
      our $uri = 'urn:SiebelPhysician';
      our %RE;

      my $server = SOAP::Transport::HTTP::CGI->new();

      $server->dispatch_with({'uri:SiebelPhysician#FindByRCN' => 'SiebelPhysician'});

      $server->handle();

      package SiebelPhysician;

      I tested the same thing from SOAPUi (by consuming the same WSDL) and the output is a bit different:

      <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
      <faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
      <faultstring xsi:type="xsd:string">SOAPAction shall match 'uri#method' if present (got 'urn:SiebelPhysician#FindByRCN', expected 'urn:SiebelPhysician#request'</faultstring>
      <faultactor xsi:type="xsd:string">urn:SiebelPhysician#request</faultactor>
      </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      What am I doing wrong?

      Thanks,
      Alceu