Patricia,

See my comments below.

Scott Nichol

----- Original Message -----
From: "Nguyen, Patricia P" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 4:14 PM
Subject: RE: Soap::Lite


>
> >
> We noticed that the URL :
> http://xml.apache.org/xml-soap/literalxml isn't found (404). We think this
> is an existing bug from SOAP.
> >       If we turn on debugging, you do see that URL in the envelope:
> >      <SOAP-ENV:Body>
> >   <ns1:getUserResponse xmlns:ns1="urn:AznUser2"
> > SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml";>
> >   <return>

> >                   Perhaps there's a redirection by Apache, but I can't
> > imagine Perl re-writing the URL on its own.

It is correct that http://xml.apache.org/xml-soap/literalxml does not refer
to a physical resource.  It does not need to.  From the abstract of RFC
2396:

   A Uniform Resource Identifier (URI) is a compact string of characters
   for identifying an abstract or physical resource.

This URI is used as an encodingStyle per SOAP 1.1 section 4.1.1
(http://www.w3.org/TR/SOAP/#_Toc478383495) to indicate the use of the
literal XML encoding of Apache SOAP.

> > The server code is working fine with java and vb
> > clients, I only have this problem with perl. Since I use the URL for
> > literalxml for Perl only.

Why are you using this as the encoding style URI for the perl client?  Does
the client actually use literal XML as its encoding style?

> > Right now I am using SOAP 1.1, I just want know if
> > this is a known problem to you (from SOAP).
> > I have posted the problem in News Group but nobody
> > seems to know anything about this.

This is not a problem.  The encoding style should indicate the style
actually used to encode the data in the SOAP message (actually, according to
the spec, you can mix encoding styles within a message).  Apache SOAP
supports SOAP encoding (section 5 of the SOAP 1.1 spec,
http://www.w3.org/TR/SOAP/#_Toc478383512), literal XML encoding, and XMI
encoding.  Both the client and server must support a particular encoding for
the encoding to work.

> >
> > One thing that concerns me is the name 'literalXML'. Web
> > Service
> > Wire Protocols, like SOAP and XML-RPC, are handy because
> > language libraries handle parsing the XML automatically and
> > let the user think in terms of his or her own language's
> > datatypes. If literalXML is disables this translation and
> > instead makes the end user parse the XML response message,
> > it seems to be that much of the power of SOAP is gone.

It so happens that in my use of SOAP I have only used it for RPC calls using
SOAP encoding.  So, as a SOAP user, I have a pretty similar perspective as
you.  However, from reading the posts to this list and working with
developers at my clients, I can say that many, many developers are using
literal encoding, and some are using one-way messaging rather than RPC.
Lots of people are using SOAP as a way to allow clients to post XML
documents to a server.  While I personally prefer WebDAV for this sort of
thing, I think it is one of the strengths of SOAP that it supports many
different uses.

Additionally, I believe that the use of SOAP encoding will decrease with the
adoption of .NET in many organizations.  This is because, by default, Visual
Studio .NET creates Web services that use doc/literal encoding.  For
example, when I fire up VS.NET, create a Web service project, then uncomment
the "starter" HelloWorld method, VS.NET generates a Web service with the
following WSDL:

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:s="http://www.w3.org/2001/XMLSchema"; xmlns:s0="http://tempuri.org/";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/";
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
targetNamespace="http://tempuri.org/";
xmlns="http://schemas.xmlsoap.org/wsdl/";>
  <types>
    <s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/";>
      <s:element name="HelloWorld">
        <s:complexType />
      </s:element>
      <s:element name="HelloWorldResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult"
type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="string" nillable="true" type="s:string" />
    </s:schema>
  </types>
  <message name="HelloWorldSoapIn">
    <part name="parameters" element="s0:HelloWorld" />
  </message>
  <message name="HelloWorldSoapOut">
    <part name="parameters" element="s0:HelloWorldResponse" />
  </message>
  <message name="HelloWorldHttpGetIn" />
  <message name="HelloWorldHttpGetOut">
    <part name="Body" element="s0:string" />
  </message>
  <message name="HelloWorldHttpPostIn" />
  <message name="HelloWorldHttpPostOut">
    <part name="Body" element="s0:string" />
  </message>
  <portType name="Service1Soap">
    <operation name="HelloWorld">
      <input message="s0:HelloWorldSoapIn" />
      <output message="s0:HelloWorldSoapOut" />
    </operation>
  </portType>
  <portType name="Service1HttpGet">
    <operation name="HelloWorld">
      <input message="s0:HelloWorldHttpGetIn" />
      <output message="s0:HelloWorldHttpGetOut" />
    </operation>
  </portType>
  <portType name="Service1HttpPost">
    <operation name="HelloWorld">
      <input message="s0:HelloWorldHttpPostIn" />
      <output message="s0:HelloWorldHttpPostOut" />
    </operation>
  </portType>
  <binding name="Service1Soap" type="s0:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http";
style="document" />
    <operation name="HelloWorld">
      <soap:operation soapAction="http://tempuri.org/HelloWorld";
style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
  <binding name="Service1HttpGet" type="s0:Service1HttpGet">
    <http:binding verb="GET" />
    <operation name="HelloWorld">
      <http:operation location="/HelloWorld" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
  </binding>
  <binding name="Service1HttpPost" type="s0:Service1HttpPost">
    <http:binding verb="POST" />
    <operation name="HelloWorld">
      <http:operation location="/HelloWorld" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
  </binding>
  <service name="Service1">
    <port name="Service1Soap" binding="s0:Service1Soap">
      <soap:address location="http://localhost/scott1/Service1.asmx"; />
    </port>
    <port name="Service1HttpGet" binding="s0:Service1HttpGet">
      <http:address location="http://localhost/scott1/Service1.asmx"; />
    </port>
    <port name="Service1HttpPost" binding="s0:Service1HttpPost">
      <http:address location="http://localhost/scott1/Service1.asmx"; />
    </port>
  </service>
</definitions>

You will notice that the soap operation has a type of "document" and soap
body use attribute of "literal".  The SOAP conversation then looks like:

--- Request ---
POST /scott1/Service1.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: xxx
SOAPAction: "http://tempuri.org/HelloWorld";

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

--- Response ---
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: xxx

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
  <soap:Body>
    <HelloWorldResponse xmlns="http://tempuri.org/";>
      <HelloWorldResult>string</HelloWorldResult>
    </HelloWorldResponse>
  </soap:Body>
</soap:Envelope>

Basically, the WSDL is required to define the encoding.  In order to get
SOAP encoding, one must use different attributes for the service class and
method(s), then set the appropriate properties on those.  For people who
know they want SOAP encoding because they want to interoperate with non-WSDL
clients, there will be motivation to use these other attributes.  For the
majority of the development community, it will not be worth the effort.

> >
> > Thank you for your help
> >
> > Patricia
> >
> > Code Client site:
> >
> > #! /usr/bin/perl
> >
> > use strict;
> >
> > use SOAP::Lite;
> >
> > BEGIN {
> >       package MySerializer; @MySerializer::ISA =
> > 'SOAP::Serializer';
> >       sub envelope {
> >         $_[2] = SOAP::Data->name("ns1:$_[2]")
> >
> > ->encodingStyle("http://xml.apache.org/xml-soap/literalxml";)
> >           ->uri('urn:AznUser2')
> >           if $_[1] =~ /^(?:method|response)$/;
> >         shift->SUPER::envelope(@_);
> >       }
> > }
> > ....more....
> >
>

Did you try the SOAP encoding style
(http://schemas.xmlsoap.org/soap/encoding/) for this client?


Reply via email to