A SOAP runtime system uses the QName of the child element of the
soap-env:body to determine what type of SOAP message it has received and
what to do with it. The TargetObjectURI defines the namespace for that
QName. That combined with the element's local name specifies the complete
QName.

When using document literal, the child element of the soap-env:body has a
predefined QName. It is specified in the schema definition in the wsdl:types
section. Hence the TargetObjectURI should be the same as the targetNamespace
in the <schema> section in the <types> section.

If you are using rpc/encoded, then the SOAP runtime dynamically constructs
the SOAP message using the SOAP encoding data model, and it uses the
wsdl:operation name (the method name) as the child element of the
soap-env:body. There is no schema that defines this element, and no
predefined namespace. Therefore you should specify a namespace attribute in
the soap:input and soap:output elements in the wsdl:binding definition,
e.g.,

 <wsdl:binding name="foo" type="tns:bar">
    <soap:binding style="rpc"
            transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="foobar">
      <soap:operation soapAction="" style="rpc"/>
      <wsdl:input>
        <soap:body
          namespace="urn:foobar"
          encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
          use="encoded"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body
          namespace="urn:foobar"
          encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
          use="encoded"/>
      </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

That namespace can be the same as your wsdl targetNamespace, but it doesn't
need to be. It can be any namespace you want it to be. You just want to make
sure that your QName provides enough information to your SOAP server to
indicate how to process the message.

Best regards,
Anne


----- Original Message -----
From: "Steve Pruitt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 18, 2003 10:31 AM
Subject: RE: TargetObjectURI


The heart of my question is basically interoperability.  I am trying to
compose a SOAP message by parsing a WSDL file and without any specific soap
platform knowledge.  I have not seen any sort of matrix specifying what the
various platform vendors require.  If the WSDL has the SOAP Action set, then
naturally I assume this required.  But, the TargetObjectURI remains
problematic to me. I have been using the namespace URI of the first child
element of the body.  But this seems "squishy" in light of Scott's response
below.

>From the response below...

If the soap:body namespace is of no use, then I am a bit confused about what
to do.  Not sure where a namespace can be explicitly specified in a message
definition?  The soap:body and soap:header are the only tags with a
namespace attribute.  Should I always use the wsdl:definition
targetNamespace attribute?  I have found wsdls where the wsdl:definition
targetNamespace and the soap:body namespace attibutes are different, so I am
a bit confused about that.

Hopefully, I am not the only one clueless about this and others face the
same issue or similar issue.


Steve Pruitt




The TargetObjectURI is always the namespace of the element representing the
SOAP call.  For example, in the envelope


<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
                      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
                      xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
<SOAP-ENV:Body>
<ns1:helloString xmlns:ns1="urn:hello1"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<name xsi:type="xsd:string">Bill</name>
</ns1:helloString>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
the TargetObjectURI is "urn:hello1".

In WSDL, the namespace attribute of the soap:body element for a binding
*may* be supplied, although the WSDL 1.1 spec says "the namespace attribute
only applies to content not explicitly defined by the abstract types".
Therefore, in most WSDL, I do not think this should be of use, because the
messages for operations are themselves in namespaces, which are the
TargetObjectURI.  The namespace may be explicitly specified in the message
definition, or it may be implied by the targetNamespace attribute on an
enclosing element, typically the wsdl:definition element.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "Steve Pruitt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 15, 2003 9:54 AM
Subject: TargetObjectURI


All,

How do you determine what WSDL value to use for setting the TargetObjectURI?
I am parsing a WSDL file at runtime and dynamically building the call.  With
Apache I have been using the namespace from the soap body extension.  But,
what if the SOAP platform is unknown?  I have looked at various WSDL files.
Sometimes the namespace attibute is not provided.  What is used in this
case?  Are there any conventions?  This is all still murky to me.


-Steve Pruitt
[EMAIL PROTECTED]


Reply via email to