users@jax-ws.java.net

Re: header out WebParam causing WebResult annotation to be ignored

From: Greg Adams <gadams_at_gmail.com>
Date: Fri, 11 Aug 2006 13:37:17 -0700

What you're suggesting causes the message part I intend to be in the header
to be named "parameters", but the response value is still "result".
Wsdl.exestill generates nasty wrappers for the response and method
parameters. I
need the method return (WebResult) message part to be named "parameters"
instead of the default, "result". That's why I'm using
@WebResult(name="parameters"), which works without @WebParam(...,
header=true), but doesn't work with it.

I noticed that the @WebResukt(name="parameters") causes the apt-generated
com.foo.jaxws.Method1Response to include an @XmlElement(name="parameters")
on the _result member. This happens with or without the @WebParam(...,
header=true). It appears that it's not a problem with apt, it's a runtime
problem with JAX-WS that causes the @XmlElement annotation in
Method1Response to be ignored when there's a header param.


On 8/11/06, Doug Kohlert <Doug.Kohlert_at_sun.com> wrote:
>
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>