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

Re: code not generated as expected

Expand Messages
  • cresswell.alex
    One of our other developers sent me a correct request to the service I am attempting to use. Here is his:
    Message 1 of 6 , Dec 7, 2010
    • 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 2 of 6 , Dec 8, 2010
      • 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.