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

code not generated as expected

Expand Messages
  • as.aellen
    Hi all My soap::lie script calls a webservice on a server. Unfortunately the server finds only some attributes/elements from the request, but not all. Perlcode
    Message 1 of 6 , Dec 3, 2010
    View Source
    • 0 Attachment

      Hi all

      My soap::lie script calls a webservice on a server. Unfortunately the server finds only some attributes/elements from the request, but not all.

      Perlcode
      ---------
      my $webService = SOAP::Lite
       -> uri('http://www.swisscom.com/onecrm/potree/propagation')
       -> proxy('http://138.187.96.39:8199/Processes/NetCracker/OneCRM/ReplicateProductInventory/v01')  #Sys1 Sirius
       -> on_action(sub{"/Processes/NetCracker/OneCRM/ReplicateProductInventory"}); #Set SoapAction, because it is different to URI

      $webService->serializer->register_ns('http://www.swisscom.com/onecrm/potree/propagation','xmlns');

      my $result = $webService-> CustomerAccount( 
       SOAP::Data->name("CustomerAccount")->type("")->value(
         SOAP::Data->attr({SCN => "1111"}),
         SOAP::Data->name("POInstance")->type("")->value(
          SOAP::Data->attr({"Action" => 'Update'}),
          SOAP::Data->name("Name")->type("")->value('TestAA'),
          SOAP::Data->name("Type")->type("")->value('PO_TestAA'),
          SOAP::Data->name("POIID")->type("")->value('ALL:SUB:1111AA')
          )
         )
        );

      Generated xml request
      -----------------------------

      <?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:xmlns="http://www.swisscom.com/onecrm/potree/propagation" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/enco
      ding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
      <CustomerAccount xmlns="http://www.swisscom.com/onecrm/potree/propagation">
      <CustomerAccount
      SCN="1111" />
      <POInstance Action="Update" />
      <Name>TestAA</Name>
      <Type>PO_TestAA</Type>
      <POIID>ALL:SUB:1111AA</POIID>
      </CustomerAccount>
      </soap:Body>
      </soap:Envelope>

      Detail Problem
      The server does not find SCN, Name,Type,POIID. It recognizes only POInstance Action = Update, but not the rest of the fields in the request.

      I pasted the generated request to SoapUI.
      When I manually change the line CustomerAccount.... to:
      <CustomerAccount SCN="1111" xmlns="http://www.swisscom.com/onecrm/potree/propagation">   

      When I manually change the line POInstance.... to:
      <POInstance Action="Update" >      / deleted
      </POInstance>      inserted at the end

      then the request works out of SoapUI

      How can I bring the soap::lite module to generate code as described. (without / at the end bySCN and Update and proper POInstance element)?

      e.g. I tried following
      SOAP::Data->name("POInstance")->type("")->value(\
      unfortunately this generated errors

      Version
      soap::lite v0.712

      I'm struggling around with that problem for a long time. So help is very appreciated!

      Thanks very much for support

      Best regards

      Andres

       

    • rahed
      ... What should the response look like? It s not clear from the wrong one. -- Radek
      Message 2 of 6 , Dec 7, 2010
      View Source
      • 0 Attachment
        "as.aellen" <as.aellen@...> writes:

        > Hi all
        >
        > My soap::lie script calls a webservice on a server. Unfortunately the
        > server finds only some attributes/elements from the request, but not
        > all.

        What should the response look like? It's not clear from the wrong one.

        --
        Radek
      • rahed
        ... Sorry, the request, not the response. -- Radek
        Message 3 of 6 , Dec 7, 2010
        View Source
        • 0 Attachment
          rahed <raherh@...> writes:

          > "as.aellen" <as.aellen@...> writes:
          >
          >> Hi all
          >>
          >> My soap::lie script calls a webservice on a server. Unfortunately the
          >> server finds only some attributes/elements from the request, but not
          >> all.
          >
          > What should the response look like? It's not clear from the wrong one.

          Sorry, the request, not the response.

          --
          Radek
        • Alex Cresswell
          In the request it sends I would expect to see
          Message 4 of 6 , Dec 7, 2010
          View Source
          • 0 Attachment
            In the request it sends "<Type xsi:nil="true" xsi:type="tns:EventGroupType" />" I would expect to see "<Type xsi:nil="true" xsi:type="tns:EventGroupType">ServerDiscoveryProcess</Type>"


             
            rahed <raherh@...> writes:

            > "as.aellen" <as.aellen@...> writes:
            >
            >> Hi all
            >>
            >> My soap::lie script calls a webservice on a server. Unfortunately the
            >> server finds only some attributes/elements from the request, but not
            >> all.
            >
            > What should the response look like? It's not clear from the wrong one.

            Sorry, the request, not the response.

            --
            Radek

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

            The information in this communication and any attachment is confidential and intended solely for the attention and use of the named addressee(s). All information and opinions expressed herein are subject to change without notice. This communication is not to be construed as an offer to sell or the solicitation of an offer to buy any security. Any such offer or solicitation can only be made by means of the delivery of a confidential private offering memorandum (which should be carefully reviewed for a complete description of investment strategies and risks). Any reliance one may place on the accuracy or validity of this information is at their own risk. Past performance is not necessarily indicative of the future results of an investment. All figures are estimated and unaudited unless otherwise noted. If you are not the intended recipient, or a person responsible for delivering this to the intended recipient, you are not authorized to and must not disclose, copy, distribute, or retain this message or any part of it. In this case, please notify the sender immediately at 713-333-5440
          • cresswell.alex
            One of our other developers sent me a correct request to the service I am attempting to use. Here is his:
            Message 5 of 6 , Dec 7, 2010
            View Source
            • 0 Attachment
              One of our other developers sent me a correct request to the service I am attempting to use. Here is his:

              <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AddEventGroup xmlns="http://tempuri.org/"><Type>ServerDiscoveryProcess</Type><Description>Scheduled Discovery</Description></AddEventGroup></soap:Body></soap:Envelope>

              --- In soaplite@yahoogroups.com, Alex Cresswell <acresswell@...> wrote:
              >
              > In the request it sends "<Type xsi:nil="true" xsi:type="tns:EventGroupType" />" I would expect to see "<Type xsi:nil="true" xsi:type="tns:EventGroupType">ServerDiscoveryProcess</Type>"
              >
              >
              >  
              > rahed <raherh@...> writes:
              >
              > > "as.aellen" <as.aellen@...> writes:
              > >
              > >> Hi all
              > >>
              > >> My soap::lie script calls a webservice on a server. Unfortunately the
              > >> server finds only some attributes/elements from the request, but not
              > >> all.
              > >
              > > What should the response look like? It's not clear from the wrong one.
              >
              > Sorry, the request, not the response.
              >
              > --
              > Radek
              >
              > -----------------------------------------------------------------------------------
              >
              > The information in this communication and any attachment is confidential and intended solely for the attention and use of the named addressee(s). All information and opinions expressed herein are subject to change without notice. This communication is not to be construed as an offer to sell or the solicitation of an offer to buy any security. Any such offer or solicitation can only be made by means of the delivery of a confidential private offering memorandum (which should be carefully reviewed for a complete description of investment strategies and risks). Any reliance one may place on the accuracy or validity of this information is at their own risk. Past performance is not necessarily indicative of the future results of an investment. All figures are estimated and unaudited unless otherwise noted. If you are not the intended recipient, or a person responsible for delivering this to the intended recipient, you are not authorized to and must not disclose, copy, distribute, or retain this message or any part of it. In this case, please notify the sender immediately at 713-333-5440
              >
            • rahed
              ... Hello, the code below generates this xml:
              Message 6 of 6 , Dec 8, 2010
              View Source
              • 0 Attachment
                <Andres.Aellen@...> writes:

                > Hi all
                >
                > As already tried to explain. When I change the generated request from perl/soap::lite to the following format and use it in SoapUI, then it works. But how can I bring soap::lite to generate a same request?
                >
                > SoapUI (changed soap::lite request)
                > <?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>
                > <CustomerAccount xmlns="http://www.swisscom.com/onecrm/potree/propagation" SCN="1111">
                > <POInstance Action="Update"> !--/removed--
                > <Name>TestAA</Name>
                > <Type>PO_TestAA</Type>
                > <POIID>ALL:SUB:1111AA</POIID>
                > </POInstance>
                > </CustomerAccount>
                > </soap:Body></soap:Envelope>
                >
                > Thanks
                > Best regards Andres

                Hello,

                the code below generates this xml:

                <?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>
                <CustomerAccount xmlns="http://www.swisscom.com/onecrm/potree/propagation" SCN="1111">
                <POInstance Action="Update">
                <Name>TestAA</Name>
                <Type>PO_TestAA</Type>
                <POIID>ALL:SUB:1111AA</POIID>
                </POInstance>
                </CustomerAccount>
                </soap:Body>
                </soap:Envelope>

                Attributes and namespace of the root method are set in a custom
                serializer and its child elements are constructed with SOAP::Data.


                code:

                $soap = SOAP::Lite
                ->uri('http://www.swisscom.com/onecrm/potree/propagation')
                ->proxy('http://138.187.96.39:8199/Processes/NetCracker/OneCRM/ReplicateProductInventory/v01') #Sys1 Sirius
                ->on_action(sub{"/Processes/NetCracker/OneCRM/ReplicateProductInventory"})
                ->serializer(MySerializer->new);

                BEGIN {
                package MySerializer;
                @MySerializer::ISA = 'SOAP::Serializer';
                sub envelope {
                $_[2] = SOAP::Data->name($_[2])->attr({SCN => 1111})->uri('http://www.swisscom.com/onecrm/potree/propagation','')->prefix('');
                shift->SUPER::envelope(@_)
                }
                }

                $soap->autotype(0);
                $soap->readable(1);

                $request = SOAP::Data->name(
                POInstance => \SOAP::Data->value(
                SOAP::Data->name(Name => 'TestAA'),
                SOAP::Data->name(Type => 'PO_TestAA'),
                SOAP::Data->name(POIID => 'ALL:SUB:1111AA'),
                ),
                )->attr({Action => 'Update'});

                $soap->CustomerAccount($request);


                --
                Radek
              Your message has been successfully submitted and would be delivered to recipients shortly.