users@jax-ws.java.net

Re: header out WebParam causing WebResult annotation to be ignored

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Fri, 11 Aug 2006 12:17:44 -0700

I am not sure this will work, but try: WebParam(name="paramters",
header=true ...)

Greg Adams wrote:

> I'm trying to use a header out param in my web service, which must be
> used with a .Net client. For some reason (don't ask me why), the
> wsdl.exe web service client proxy generator shipped with Visual Studio
> 2005 really wants the message part for the result in the response
> named "parameters" when using a header out param as well. JAX-WS
> defaults to naming the message part "result", which causes wsdl.exe to
> generate wrapper objects for the response and parameters. Anyways, I
> tried to work around .Net by using this:
>
>package com.foo;
>
>import
> javax.jws.WebParam;
>import javax.jws.WebResult;
>import javax.jws.WebService;
>import javax.xml.ws.Holder;
>
>
>@WebService(serviceName="TestService")
>public class TestEndPoint {
>
> @WebResult(name=
>"parameters")
> public String method1(@WebParam(mode=WebParam.Mode.OUT, header=true) Holder<Header> header)
>{
> header.value = new Header();
> header.value.setHeaderValue("Header Value");
> return
>"method1 Return";
> }
>}
>
>
>
>
>
> but it appears that when using the WebParam annotation with
> header=true, the WebResult annotation gets ignored. If I remove the
> header=true from the WebParam annotation, the message part is called
> "parameters", but with header=true, the message part is called "result":
>
><?xml version="1.0" encoding="UTF-8"?>
><definitions xmlns: tns="http://foo.com/
> <http://foo.com/>" xmlns: xsd="http://www.w3.org/2001/XMLSchema"
>xmlns: soap="
>http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"
>targetNamespace="
>http://foo.com/" name="TestService">
>
> <types>
> <xsd:schema>
> <xsd:import
> namespace="http://foo.com/" schemaLocation="http://localhost:8080/jaxWsTest/services/Test?xsd=1
> <http://localhost:8080/jaxWsTest/services/Test?xsd=1>"></xsd:import>
> </xsd:schema>
> </types>
> <message name="method1">
> <part element="tns:method1"
> name="parameters"></part>
> </message>
> <message name="method1Response">
> <part element=
>"tns:method1Response" name="result"></part>
> <part element="tns:arg0" name="arg0"
>></part>
> </message>
> <portType name="TestEndPoint">
> <operation parameterOrder="parameters arg0" name=
>"method1">
> <input message="tns:method1"></input>
> <output message="tns:method1Response"></output>
>
> </operation>
> </portType>
> <binding type="tns:TestEndPoint" name="TestEndPointPortBinding">
> <soap:binding style=
>"document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
> <operation name=
>"method1">
> <soap:operation soapAction=""></soap:operation>
> <input>
> <soap:body use=
>"literal"></soap:body>
> </input>
> <output>
> <soap:body parts="result" use="literal"></soap:body>
>
> <soap:header part="arg0" message="tns:method1Response" use="literal"></soap:header>
> </output>
>
> </operation>
> </binding>
> <service name="TestService">
> <port binding="tns:TestEndPointPortBinding" name=
>"TestEndPointPort">
> <soap:address location="http://localhost:8080/jaxWsTest/services/Test"></soap:address>
>
> </port>
> </service>
></definitions>
>
>
>
>
>
>
> Any ideas?
>
> Greg