You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Mark D. Hansen" <m....@verizon.net> on 2004/07/01 19:59:56 UTC

RE: SoapAction = (Target Namespace + Operation name) Always??

I was reviewing this old post from Anne Thomas Manes (which - as usual has tons of useful information), and I'm wondering where the conventions described for naming the SOAP body child element in a doc/lit request comes from??  SOAP 1.1 and WSDL 1.1 both seem to be less specific.  I can't even see anything in the SOAP or WSDL specs that indicates that a doc/lit request MUST have a single child element (although if it does not, it isn't clear how the SOAP server could figure out what operation to map the request to).

Can anybody clarify this for me?

Thanks,

Mark

> -----Original Message-----
> From: Anne Thomas Manes [mailto:anne@manes.net]
> Sent: Thursday, July 24, 2003 12:05 PM
> To: 'axis-user@ws.apache.org'
> Subject: Re: SoapAction = (Target Namespace + Operation name) Always??
> 
> 
> Denero,
> 
> SOAPAction is an HTTP Header attribute. According to the SOAP 
> specification,
> it provides a "hint" that the SOAP server can use for routing. The
> SOAPAction header is always required in all SOAP over HTTP 
> requests, but it
> is not used with other transports (JMS, SMPT, etc). The 
> contents of the
> header can be null, blank, or a URI, e.g.:
> 
>   SOAPAction:
>   SOAPAction: ""
>   SOAPAction: "urn:myservice/foobar/foo"
>   SOAPAction: "http://example.org/foobar#1234567890"
> 
> There's no requirement that if you specify a URI that it must be the
> targetNamespace + Operation name (such as 
> "urn:myservice/foobar/foo"). Many
> systems don't specify a URI, especially when using 
> rpc/encoded. On the other
> hand, some systems generate a method signature for the 
> SOAPAction attribute
> (such as "http://example.org/foobar#1234567890"). The contents of the
> SOAPAction will be determined by the SOAP Server you use to 
> host the Web
> service.
> 
> As I mentioned, the SOAPAction provides a "hint" that the 
> SOAP server can
> use to optimize request routing. Officially, though, the SOAP 
> server should
> use the QName of the child element of the soap-env:body to 
> determine how to
> process the request. (Remember that SOAP can run over other 
> transports, and
> other transports don't have the equivalent of SOAPAction.) To 
> demonstrate:
> 
>  <soap-env:body>
>    <ns1:foo xmlns:ns1="urn:myservice/foobar">
>       <ns1:bar>test</ns1:bar>
>    </ns1:foo>
>  </soap-env:body>
> 
> In this example, the QName of the child element of the 
> soap-env:body is
> "urn:myservice/foobar}foo".
> 
> When using doc/literal, the service developer must define the 
> the QName of
> the child element of the soap-env:body in the wsdl:types 
> element. This QName
> uses the targetNamespace of the <xsd:schema> element (which isn't
> necessarily the same as the targetNamespace of the <wsdl:definitions>
> element) combined with the local name of the element that defines the
> message payload. In other words, the QName is equal to the 
> value specified
> in the element attribute in the <wsdl:part>, e.g.:
> 
>   <wsdl:part name="body" element="ns1:foo">
> 
> When using rpc/encoded, you don't have a schema of the SOAP 
> message body, so
> the SOAP runtime generates the QName of the child element of the
> soap-env:body from information specified in the 
> <wsdl:binding> -- uses the
> name attribute in the <wsdl:operation> as its local name, and 
> it uses the
> namespace specified in the <wsdl:input> element:
> 
> <wsdl:binding name="foobarBinding" type="tns:foobarPortType">
>    <soap:binding style="rpc"
> transport="http://schemas.xmlsoap.org/soap/http" />
>    <wsdl:operation name="foo">   <--local name
>       <soap:operation soapAction="urn:myservice/foobar/foo" />
>    <wsdl:input>
>       <soap:body use="encoded"
>         namespace="urn:myservice/foobar"     <-- namespace
>         encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
>    </wsdl:input>
>    ...
> </wsdl:binding>
> 
> So again, in this example, the QName of the child element of the
> soap-env:body would be "urn:myservice/foobar}foo".
> 
> Best regards,
> Anne
> 
> ----- Original Message -----
> From: Denero Watz
> To: axis-user@ws.apache.org
> Sent: Thursday, July 24, 2003 1:49 AM
> Subject: SoapAction = (Target Namespace + Operation name) Always??
> 
> 
> Hello!!
>     I have just started on Soap and writing a Soap client now 
> for a project.
> While looking at the documentation, I see the following are 
> some of the
> parameters needed while sending a request.
> 
> - Operation name
> - A Name Space
> - A Soap action for the header
> 
> Why is these attributes required separately in the WSDL. The 
> Soap action is
> actually the combination of the target namespace and the 
> operation, right?
> Or they can be different?
> 
> Atleast, in my case we have a UI to set this fields by the 
> users, so my
> question is that will it work if I show only op name and namespace to
> specify by the user and I internally resolve the Soapaction 
> url based on
> this target namespace and operation name he has selected 
> before sending a
> soap request?
> 
> TIA,
> dw
> 
> 
> 
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
>