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

1657Re: [soaplite] More about Problem with WSDL file with document-literal style

Expand Messages
  • Weidong Wang
    Jun 28, 2002
      I think I know better about the problem after some more tries.
       
      The concept of passing in multiple parameters is for rpc. When one uses a doc/literal style wsdl, it basically says that the body of the envelope should just be an xml document. As such, each call should just take one parameter, which should be the xml document that goes as the body element. If additional parameters are passed in, SOAP-Lite encodes them with soap encoding and add them as part of the body.
       
      I tried passing in a piece of xml document, it looks better.
       
      But, the envelope still has one more extra level. See below:
       
      <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        <SOAP-ENV:Body>
          <namesp1:GetLastTradePrice xmlns:namesp1="http://example.com/StockQuoteService/">
            <body>MSFT</body>
          </namesp1:GetLastTradePrice>
        </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
       
      the "body" part should be the body element underneath "Body". Looks like the RPC convention is still used to generate the wrapper, then the xml document is put inside the "body" part.
       
      This seems to be incorrect, according to the WSDL spec.
       
      How do I work around it?
       
      Thanks,
       
      Weidong
       
       
      ----- Original Message -----
      Sent: Friday, June 28, 2002 1:07 PM
      Subject: Re: [soaplite] More about Problem with WSDL file with document-literal style

      More about the problem with handling a WSDL with document-literal style. I would like to know how I can make soap-lite to handle the document-literal style wsdl file and how to pass parameters (not to be soap encoded). Thanks.
       
      Attached is a simple stockquote.wsdl, which uses docuemtn-literal style.
       
      When feeding this wsdl into .NET, here is the envelope .NET generates (notice that the body value is an xml docuemtn with no soap encoding info):
       
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <TradePriceRequest xmlns="http://example.com/stockquote.xsd">
            <tickerSymbol>MSFT</tickerSymbol>
          </TradePriceRequest>
        </soap:Body>
      </soap:Envelope>
       
      When using this WSDL with SOAP-Lite, with the following code to call it:
       
      use SOAP::Lite on_debug => sub { print @_ };
       
      print SOAP::Lite
          -> service('file:stockquote.wsdl')
          -> GetLastTradePrice('MSFT');
      I got the following envelope (note the tickerSymbol part is named "body"):
       
      <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        <SOAP-ENV:Body>
          <namesp1:GetLastTradePrice xmlns:namesp1="http://example.com/StockQuoteService/">
            <body>MSFT</body>
          </namesp1:GetLastTradePrice>
        </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
       
      And if I call with the following manner:
       
      use SOAP::Lite on_debug => sub { print @_ };
       
      $soap = SOAP::Lite
          -> service('file:stockquote.wsdl');
       
      $result = $soap->GetLastTradePrice(SOAP::Data->name(tickerSymbol => 'MSFT'));
      print $result;
      I got (notice that ticketSymbol is now encoded. Not surprise, as using SOAP::Data means soap encoding. But how do I do otherwise?):
       
      <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        <SOAP-ENV:Body>
          <namesp1:GetLastTradePrice xmlns:namesp1="http://example.com/StockQuoteService/">
            <tickerSymbol xsi:type="xsd:string">MSFT</tickerSymbol>
          </namesp1:GetLastTradePrice>
        </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    • Show all 4 messages in this topic