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

Server interprets parameter as empty even the client sends it with a value

Expand Messages
  • as.aellen
    Hi all My perl soap client sends a Soap reques to the Server. Basically this works and the server finds the operation getCustomerAccessState. when it
    Message 1 of 2 , Nov 2, 2010
    • 0 Attachment

      Hi all

      My perl soap client sends a Soap reques to the Server. Basically this works and the server finds the operation getCustomerAccessState. when it interprets the passed parameter customerIdentification it interprets it always as empty. in the trace you can see that the request contains the parameter with the value <customerIdentification>0123456700.

      what's wrong on the request? namespace? encoding? ?????

       

       

       

       

      I get the following error when my soap::lite client calls the webService

      Error

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><m:g
      etCustomerAccessStateResponse xmlns:m="http://www.swisscom.com/aih/2008-002/ws/docstylewrapper"><m:getCustomerAccessStateReturn xmlns:par="http://www.swisscom.com/ai
      h/2008-002/ws/parameter" xsi:type="par:AihWsExceptionResponse"><par:exception>true</par:exception><par:exceptionType>InvalidArgumentException</par:exceptionType><par
      :exceptionMessage>customerIdentification field is empty.</par:exceptionMessage><par:exceptionDetail>com.xxx.aih.x2008002.ws.parameter.AihWsExceptionResponse: cu
      stomerIdentification field is empty.</par:exceptionDetail></m:getCustomerAccessStateReturn></m:getCustomerAccessStateResponse></soapenv:Body></soapenv:Envelope>
      Resultat: AihWsExceptionResponse=HASH(0x21bec64)

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

      code

      my $nummer = SOAP::Data
         ->type('')
        ->name('customerIdentification')
        ->value('0123456700');

      my $webService = SOAP::Lite
        -> uri('http://www.swisscom.com/aih/2008-002/ws/docstylewrapper')  #uri: #Namespace: Transport, Server, Klasse
        -> proxy('http://138.187.96.39:8299/aihws/services/AihWsV03')  #Sys2  proxy: URL   (8199 SIRIUS)
       -> encoding('UTF-8');

      my $result = $webService-> getCustomerAccessState($nummer);
        unless ($result->fault) {
        print "Resultat: ";
          print $result->result();
        } else {
         print "Resultat Error: ";  #Abfangen von Soap::lite Errors nicht CIA welche mit isException true daher kommen
         print join ', ',
            $result->faultcode,
            $result->faultstring;
        }
       print "\n";

      Perl version:  v5.10.0

      Modul version: ? how can I figure that out?

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

      Sent Message:


      <?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/"><s
      oap:Body><getCustomerAccessState xmlns="http://www.swisscom.com/aih/2008-002/ws/docstylewrapper"><customerIdentification>0123456700</customerIdentification></getCust
      omerAccessState></soap:Body></soap:Envelope>
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x2090fec)
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK

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

      WSDL/XSD

      In my parameter xsd the parameter is defined as:

      <xsd:complexType name="GetCustomerAccessStateRequest">

      <xsd:sequence>

      <xsd:element name="customerIdentification">

      <xsd:simpleType>

      <xsd:restriction base="xsd:string">

      <xsd:minLength value="1" />

      <xsd:maxLength value="255" />

      </xsd:restriction>

      </xsd:simpleType>

      </xsd:element>

      </xsd:sequence>

      </xsd:complexType>

       

      (customerIdentification is in the targetnamespace namespace

      =http://www.swisscom.com/aih/2008-002/ws/parameter defined)

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

       

      I hope the copied parts are the relevant parts.

      Thanks very much for help

      Have a nice day

      Andres

    • Martin Busik
      Hi, ... I d suppose it is the namespace. Check if your xsd contains an attribute elementFormDefault= qualified if this is the case, you have to use a
      Message 2 of 2 , Nov 2, 2010
      • 0 Attachment
        Hi,

        > My perl soap client sends a Soap reques to the Server.
        > Basically this works and the server finds the operation
        > getCustomerAccessState. when it interprets the passed
        > parameter customerIdentification it interprets it always as
        > empty. in the trace you can see that the request contains the
        > parameter with the value <customerIdentification>0123456700.
        >
        > what's wrong on the request? namespace? encoding? ?????

        I'd suppose it is the namespace. Check if your xsd contains an attribute
        elementFormDefault="qualified"

        if this is the case, you have to use a namespace prefix for all inner xml
        elements of your request, e.g.


        $webService->serializer->register_ns('http://www.swisscom.com/aih/2008-002/w
        s/docstylewrapper','myns123');

        my $nummer = SOAP::Data
        ->type('')
        ->name('myns123:customerIdentification')
        ->value('0123456700');

        HTH,
        Martin
      Your message has been successfully submitted and would be delivered to recipients shortly.