You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marty Saxton <ms...@2wire.com> on 2007/07/18 23:10:01 UTC

HelloWorld service, getting NULL return value: possible BUG

I found a workaround to the return value null problem.  Here's the
additional info:  I have an annotated interface for the service in the
server, and am generating the WSDL using java2wsdl.  Then I generate the
client using this wsdl using wsdl2java.  I was getting the null until I
changed the SOAPBinding.parameterStyle to BARE.  The default value of
WRAPPED causes it to fail.  So now my interface looks like this:

@WebService
public interface HelloWorld {
	@WebMethod
	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    String sayHi(String text);
}

I wonder if it has anything to do with the default name of the WebResult
is 'return'.  In the implementation, I think this gets renamed to
'_return'.  Maybe this is why the return value doesn't get unmarshalled
correctly, not sure....





-----Original Message-----
From: Marty Saxton [mailto:msaxton@2wire.com] 
Sent: Wednesday, July 18, 2007 12:45 PM
To: cxf-user@incubator.apache.org
Subject: RE: attempting HelloWorld service, getting NULL return value

Yes, something is up with the client, and it's only in jax-ws frontend.
The simple front end works.  I am using CXF 2.0-incubator.

Here's my main.  The 1st hunk of code uses the classes generated from
the java2wsdl tool.  This is the one that is returning the null.  The
2nd hunk of code uses the simple front end, and it works fine.


public static void main(String[] args) {

	HelloWorldImplService hws = new HelloWorldImplService();
	HelloWorld hw = hws.getHelloWorldImplPort();
	String s = hw.sayHi("asdf");
	System.out.println(s);
		
	final String SERVICE_URL =
"http://localhost:8080/hello/HelloWorld";
	ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
	factory.setServiceClass(HelloWorld.class);
	factory.setAddress(SERVICE_URL);
	HelloWorld helloWorldClient = (HelloWorld) factory.create();	
	s = helloWorldClient.sayHi("asdf");
	System.out.println(s);
}


Here's the HelloWorld interface that was generated by java2wsdl (run
from the maven plugin).  The one thing that is suspect is the
targetNamespace for @WebResult is empty string.  I think it should be
"http://test.twowire/".

@WebService(targetNamespace = "http://test.twowire/", name =
"HelloWorld")
public interface HelloWorld {

    @WebResult(targetNamespace = "", name = "return")
    @RequestWrapper(localName = "sayHi", targetNamespace =
"http://test.twowire/", className = "twowire.test.SayHi")
    @ResponseWrapper(localName = "sayHiResponse", targetNamespace =
"http://test.twowire/", className = "twowire.test.SayHiResponse")
    @WebMethod
    public java.lang.String sayHi(
        @WebParam(targetNamespace = "", name = "arg0")
        java.lang.String arg0
    );
}


Here is the WSDL (which was generated via wsdl2java):

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions
xmlns:ns1="http://test.twowire/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="HelloWorldImplService" targetNamespace="http://test.twowire/">
  <wsdl:types>
<xsd:schema xmlns="http://test.twowire/"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://test.twowire/">
<xsd:element name="sayHi" type="sayHi"/>
<xsd:complexType name="sayHi">
<xsd:sequence>
<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="sayHiResponse" type="sayHiResponse"/>
<xsd:complexType name="sayHiResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="sayHiResponse">
    <wsdl:part element="ns1:sayHiResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="sayHi">
    <wsdl:part element="ns1:sayHi" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="HelloWorld">
    <wsdl:operation name="sayHi">
      <wsdl:input message="ns1:sayHi" name="sayHi">
    </wsdl:input>
      <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="HelloWorldImplServiceSoapBinding"
type="ns1:HelloWorld">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="sayHi">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="sayHi">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="sayHiResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="HelloWorldImplService">
    <wsdl:port binding="ns1:HelloWorldImplServiceSoapBinding"
name="HelloWorldImplPort">
      <soap:address location="http://localhost:8080/hello/HelloWorld"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>



Thanks in advance!



-----Original Message-----
From: Liu, Jervis [mailto:jliu@iona.com] 
Sent: Tuesday, July 17, 2007 9:09 PM
To: cxf-user@incubator.apache.org
Subject: RE: attempting HelloWorld service, getting NULL return value

Hi Marty, as you said, you've examined the message flowing between
client and client and it is correct, in this case, must be sth wrong
with your client. You may want to send us your client code, so that we
can take a quick look to see what happened there.

Thanks,
Jervis

-----Original Message-----
From: Marty Saxton [mailto:msaxton@2wire.com]
Sent: 2007?7?18? 3:35
To: cxf-user@incubator.apache.org
Subject: attempting HelloWorld service, getting NULL return value


I am using CXF as both the client and server, and I'm just trying to get
the following simple service working:
 
@WebService
public interface HelloWorld {
    String sayHi(String text);
}
 
 
The implementation just returns "Hello " + text.  I examined the XML
flowing between the client & server and it appears correct, the server
is returning a correct message.  On the client side, using the jax-ws
frontend, I get a null instead of a string for the return value.  I must
be doing something terribly wrong, but I'm not sure where to begin
debugging this problem.
 
Thanks in advance!
 
 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
Ireland

Re: HelloWorld service, getting NULL return value: possible BUG

Posted by Daniel Kulp <dk...@apache.org>.
Marty,

We're still fixing bugs..  :-)

Seriously, we're hoping to do the 2.0.1 release builds either this coming 
Friday or Monday.   

Dan

On Monday 23 July 2007 16:16, Marty Saxton wrote:
> Dan:
>
> I just tried the snapshot (2.0.1-incubator-SNAPSHOT) and it worked
> without having to do ParameterStyle.BARE.  Looks like it's fixed now.
>
> :)
>
> Anyone know when 2.0.1 will be promoted to release?
>
> Thanks.
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Wednesday, July 18, 2007 9:05 PM
> To: cxf-user@incubator.apache.org
> Subject: Re: HelloWorld service, getting NULL return value: possible
> BUG
>
>
> Marty,
>
> Any chance you could try a SNAPSHOT version of CXF?   I just uploaded
> a new snapshot to:
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/ap
>ac he-cxf/2.0.1-incubator-SNAPSHOT/
>
> This looks very similar to some of the issues I fixed yesterday
> related to:
> https://issues.apache.org/jira/browse/CXF-802
>
> If not, don't worry, I'll try your testcase in the next day or two.
>
> Dan
>
> On Wednesday 18 July 2007 17:10, Marty Saxton wrote:
> > I found a workaround to the return value null problem.  Here's the
> > additional info:  I have an annotated interface for the service in
> > the server, and am generating the WSDL using java2wsdl.  Then I
> > generate the client using this wsdl using wsdl2java.  I was getting
> > the null until I changed the SOAPBinding.parameterStyle to BARE. 
> > The default value of WRAPPED causes it to fail.  So now my interface
> > looks like this:
> >
> > @WebService
> > public interface HelloWorld {
> > 	@WebMethod
> > 	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> >     String sayHi(String text);
> > }
> >
> > I wonder if it has anything to do with the default name of the
> > WebResult is 'return'.  In the implementation, I think this gets
> > renamed to '_return'.  Maybe this is why the return value doesn't
> > get unmarshalled correctly, not sure....
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Marty Saxton [mailto:msaxton@2wire.com]
> > Sent: Wednesday, July 18, 2007 12:45 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: attempting HelloWorld service, getting NULL return
> > value
> >
> > Yes, something is up with the client, and it's only in jax-ws
> > frontend. The simple front end works.  I am using CXF 2.0-incubator.
> >
> > Here's my main.  The 1st hunk of code uses the classes generated
> > from the java2wsdl tool.  This is the one that is returning the
> > null.  The 2nd hunk of code uses the simple front end, and it works
> > fine.
> >
> >
> > public static void main(String[] args) {
> >
> > 	HelloWorldImplService hws = new HelloWorldImplService();
> > 	HelloWorld hw = hws.getHelloWorldImplPort();
> > 	String s = hw.sayHi("asdf");
> > 	System.out.println(s);
> >
> > 	final String SERVICE_URL =
> > "http://localhost:8080/hello/HelloWorld";
> > 	ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
> > 	factory.setServiceClass(HelloWorld.class);
> > 	factory.setAddress(SERVICE_URL);
> > 	HelloWorld helloWorldClient = (HelloWorld) factory.create();
> > 	s = helloWorldClient.sayHi("asdf");
> > 	System.out.println(s);
> > }
> >
> >
> > Here's the HelloWorld interface that was generated by java2wsdl (run
> > from the maven plugin).  The one thing that is suspect is the
> > targetNamespace for @WebResult is empty string.  I think it should
> > be "http://test.twowire/".
> >
> > @WebService(targetNamespace = "http://test.twowire/", name =
> > "HelloWorld")
> > public interface HelloWorld {
> >
> >     @WebResult(targetNamespace = "", name = "return")
> >     @RequestWrapper(localName = "sayHi", targetNamespace =
> > "http://test.twowire/", className = "twowire.test.SayHi")
> >     @ResponseWrapper(localName = "sayHiResponse", targetNamespace =
> > "http://test.twowire/", className = "twowire.test.SayHiResponse")
> >     @WebMethod
> >     public java.lang.String sayHi(
> >         @WebParam(targetNamespace = "", name = "arg0")
> >         java.lang.String arg0
> >     );
> > }
> >
> >
> > Here is the WSDL (which was generated via wsdl2java):
> >
> > <?xml version="1.0" encoding="UTF-8"
> > standalone="no"?><wsdl:definitions xmlns:ns1="http://test.twowire/"
> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > name="HelloWorldImplService" targetNamespace="http://test.twowire/">
> >   <wsdl:types>
> > <xsd:schema xmlns="http://test.twowire/"
> > attributeFormDefault="unqualified" elementFormDefault="unqualified"
> > targetNamespace="http://test.twowire/">
> > <xsd:element name="sayHi" type="sayHi"/>
> > <xsd:complexType name="sayHi">
> > <xsd:sequence>
> > <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > <xsd:element name="sayHiResponse" type="sayHiResponse"/>
> > <xsd:complexType name="sayHiResponse">
> > <xsd:sequence>
> > <xsd:element minOccurs="0" name="return" type="xsd:string"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>
> >   </wsdl:types>
> >   <wsdl:message name="sayHiResponse">
> >     <wsdl:part element="ns1:sayHiResponse" name="parameters">
> >     </wsdl:part>
> >   </wsdl:message>
> >   <wsdl:message name="sayHi">
> >     <wsdl:part element="ns1:sayHi" name="parameters">
> >     </wsdl:part>
> >   </wsdl:message>
> >   <wsdl:portType name="HelloWorld">
> >     <wsdl:operation name="sayHi">
> >       <wsdl:input message="ns1:sayHi" name="sayHi">
> >     </wsdl:input>
> >       <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse">
> >     </wsdl:output>
> >     </wsdl:operation>
> >   </wsdl:portType>
> >   <wsdl:binding name="HelloWorldImplServiceSoapBinding"
> > type="ns1:HelloWorld">
> >     <soap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >     <wsdl:operation name="sayHi">
> >       <soap:operation soapAction="" style="document"/>
> >       <wsdl:input name="sayHi">
> >         <soap:body use="literal"/>
> >       </wsdl:input>
> >       <wsdl:output name="sayHiResponse">
> >         <soap:body use="literal"/>
> >       </wsdl:output>
> >     </wsdl:operation>
> >   </wsdl:binding>
> >   <wsdl:service name="HelloWorldImplService">
> >     <wsdl:port binding="ns1:HelloWorldImplServiceSoapBinding"
> > name="HelloWorldImplPort">
> >       <soap:address
> > location="http://localhost:8080/hello/HelloWorld"/> </wsdl:port>
> >   </wsdl:service>
> > </wsdl:definitions>
> >
> >
> >
> > Thanks in advance!
> >
> >
> >
> > -----Original Message-----
> > From: Liu, Jervis [mailto:jliu@iona.com]
> > Sent: Tuesday, July 17, 2007 9:09 PM
> > To: cxf-user@incubator.apache.org
> > Subject: RE: attempting HelloWorld service, getting NULL return
> > value
> >
> > Hi Marty, as you said, you've examined the message flowing between
> > client and client and it is correct, in this case, must be sth wrong
> > with your client. You may want to send us your client code, so that
> > we can take a quick look to see what happened there.
> >
> > Thanks,
> > Jervis
> >
> > -----Original Message-----
> > From: Marty Saxton [mailto:msaxton@2wire.com]
> > Sent: 2007?7?18? 3:35
> > To: cxf-user@incubator.apache.org
> > Subject: attempting HelloWorld service, getting NULL return value
> >
> >
> > I am using CXF as both the client and server, and I'm just trying to
> > get the following simple service working:
> >
> > @WebService
> > public interface HelloWorld {
> >     String sayHi(String text);
> > }
> >
> >
> > The implementation just returns "Hello " + text.  I examined the XML
> > flowing between the client & server and it appears correct, the
> > server is returning a correct message.  On the client side, using
> > the jax-ws frontend, I get a null instead of a string for the return
> > value.  I must be doing something terribly wrong, but I'm not sure
> > where to begin debugging this problem.
> >
> > Thanks in advance!
> >
> >
> >
> > ----------------------------
> > IONA Technologies PLC (registered in Ireland)
> > Registered Number: 171387
> > Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> > Ireland

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: HelloWorld service, getting NULL return value: possible BUG

Posted by Marty Saxton <ms...@2wire.com>.
Dan:

I just tried the snapshot (2.0.1-incubator-SNAPSHOT) and it worked
without having to do ParameterStyle.BARE.  Looks like it's fixed now.
:)

Anyone know when 2.0.1 will be promoted to release?

Thanks.

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Wednesday, July 18, 2007 9:05 PM
To: cxf-user@incubator.apache.org
Subject: Re: HelloWorld service, getting NULL return value: possible BUG


Marty,

Any chance you could try a SNAPSHOT version of CXF?   I just uploaded a 
new snapshot to:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apac
he-cxf/2.0.1-incubator-SNAPSHOT/

This looks very similar to some of the issues I fixed yesterday related 
to:
https://issues.apache.org/jira/browse/CXF-802

If not, don't worry, I'll try your testcase in the next day or two.

Dan


On Wednesday 18 July 2007 17:10, Marty Saxton wrote:
> I found a workaround to the return value null problem.  Here's the
> additional info:  I have an annotated interface for the service in the
> server, and am generating the WSDL using java2wsdl.  Then I generate
> the client using this wsdl using wsdl2java.  I was getting the null
> until I changed the SOAPBinding.parameterStyle to BARE.  The default
> value of WRAPPED causes it to fail.  So now my interface looks like
> this:
>
> @WebService
> public interface HelloWorld {
> 	@WebMethod
> 	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     String sayHi(String text);
> }
>
> I wonder if it has anything to do with the default name of the
> WebResult is 'return'.  In the implementation, I think this gets
> renamed to '_return'.  Maybe this is why the return value doesn't get
> unmarshalled correctly, not sure....
>
>
>
>
>
> -----Original Message-----
> From: Marty Saxton [mailto:msaxton@2wire.com]
> Sent: Wednesday, July 18, 2007 12:45 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: attempting HelloWorld service, getting NULL return value
>
> Yes, something is up with the client, and it's only in jax-ws
> frontend. The simple front end works.  I am using CXF 2.0-incubator.
>
> Here's my main.  The 1st hunk of code uses the classes generated from
> the java2wsdl tool.  This is the one that is returning the null.  The
> 2nd hunk of code uses the simple front end, and it works fine.
>
>
> public static void main(String[] args) {
>
> 	HelloWorldImplService hws = new HelloWorldImplService();
> 	HelloWorld hw = hws.getHelloWorldImplPort();
> 	String s = hw.sayHi("asdf");
> 	System.out.println(s);
>
> 	final String SERVICE_URL =
> "http://localhost:8080/hello/HelloWorld";
> 	ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
> 	factory.setServiceClass(HelloWorld.class);
> 	factory.setAddress(SERVICE_URL);
> 	HelloWorld helloWorldClient = (HelloWorld) factory.create();
> 	s = helloWorldClient.sayHi("asdf");
> 	System.out.println(s);
> }
>
>
> Here's the HelloWorld interface that was generated by java2wsdl (run
> from the maven plugin).  The one thing that is suspect is the
> targetNamespace for @WebResult is empty string.  I think it should be
> "http://test.twowire/".
>
> @WebService(targetNamespace = "http://test.twowire/", name =
> "HelloWorld")
> public interface HelloWorld {
>
>     @WebResult(targetNamespace = "", name = "return")
>     @RequestWrapper(localName = "sayHi", targetNamespace =
> "http://test.twowire/", className = "twowire.test.SayHi")
>     @ResponseWrapper(localName = "sayHiResponse", targetNamespace =
> "http://test.twowire/", className = "twowire.test.SayHiResponse")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "arg0")
>         java.lang.String arg0
>     );
> }
>
>
> Here is the WSDL (which was generated via wsdl2java):
>
> <?xml version="1.0" encoding="UTF-8"
> standalone="no"?><wsdl:definitions xmlns:ns1="http://test.twowire/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> name="HelloWorldImplService" targetNamespace="http://test.twowire/">
>   <wsdl:types>
> <xsd:schema xmlns="http://test.twowire/"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://test.twowire/">
> <xsd:element name="sayHi" type="sayHi"/>
> <xsd:complexType name="sayHi">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="sayHiResponse" type="sayHiResponse"/>
> <xsd:complexType name="sayHiResponse">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="return" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="sayHiResponse">
>     <wsdl:part element="ns1:sayHiResponse" name="parameters">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="sayHi">
>     <wsdl:part element="ns1:sayHi" name="parameters">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:portType name="HelloWorld">
>     <wsdl:operation name="sayHi">
>       <wsdl:input message="ns1:sayHi" name="sayHi">
>     </wsdl:input>
>       <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="HelloWorldImplServiceSoapBinding"
> type="ns1:HelloWorld">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="sayHi">
>       <soap:operation soapAction="" style="document"/>
>       <wsdl:input name="sayHi">
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="sayHiResponse">
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="HelloWorldImplService">
>     <wsdl:port binding="ns1:HelloWorldImplServiceSoapBinding"
> name="HelloWorldImplPort">
>       <soap:address
> location="http://localhost:8080/hello/HelloWorld"/> </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
>
>
> Thanks in advance!
>
>
>
> -----Original Message-----
> From: Liu, Jervis [mailto:jliu@iona.com]
> Sent: Tuesday, July 17, 2007 9:09 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: attempting HelloWorld service, getting NULL return value
>
> Hi Marty, as you said, you've examined the message flowing between
> client and client and it is correct, in this case, must be sth wrong
> with your client. You may want to send us your client code, so that we
> can take a quick look to see what happened there.
>
> Thanks,
> Jervis
>
> -----Original Message-----
> From: Marty Saxton [mailto:msaxton@2wire.com]
> Sent: 2007?7?18? 3:35
> To: cxf-user@incubator.apache.org
> Subject: attempting HelloWorld service, getting NULL return value
>
>
> I am using CXF as both the client and server, and I'm just trying to
> get the following simple service working:
>
> @WebService
> public interface HelloWorld {
>     String sayHi(String text);
> }
>
>
> The implementation just returns "Hello " + text.  I examined the XML
> flowing between the client & server and it appears correct, the server
> is returning a correct message.  On the client side, using the jax-ws
> frontend, I get a null instead of a string for the return value.  I
> must be doing something terribly wrong, but I'm not sure where to
> begin debugging this problem.
>
> Thanks in advance!
>
>
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: HelloWorld service, getting NULL return value: possible BUG

Posted by Daniel Kulp <dk...@apache.org>.
Marty,

Any chance you could try a SNAPSHOT version of CXF?   I just uploaded a 
new snapshot to:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.0.1-incubator-SNAPSHOT/

This looks very similar to some of the issues I fixed yesterday related 
to:
https://issues.apache.org/jira/browse/CXF-802

If not, don't worry, I'll try your testcase in the next day or two.

Dan


On Wednesday 18 July 2007 17:10, Marty Saxton wrote:
> I found a workaround to the return value null problem.  Here's the
> additional info:  I have an annotated interface for the service in the
> server, and am generating the WSDL using java2wsdl.  Then I generate
> the client using this wsdl using wsdl2java.  I was getting the null
> until I changed the SOAPBinding.parameterStyle to BARE.  The default
> value of WRAPPED causes it to fail.  So now my interface looks like
> this:
>
> @WebService
> public interface HelloWorld {
> 	@WebMethod
> 	@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     String sayHi(String text);
> }
>
> I wonder if it has anything to do with the default name of the
> WebResult is 'return'.  In the implementation, I think this gets
> renamed to '_return'.  Maybe this is why the return value doesn't get
> unmarshalled correctly, not sure....
>
>
>
>
>
> -----Original Message-----
> From: Marty Saxton [mailto:msaxton@2wire.com]
> Sent: Wednesday, July 18, 2007 12:45 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: attempting HelloWorld service, getting NULL return value
>
> Yes, something is up with the client, and it's only in jax-ws
> frontend. The simple front end works.  I am using CXF 2.0-incubator.
>
> Here's my main.  The 1st hunk of code uses the classes generated from
> the java2wsdl tool.  This is the one that is returning the null.  The
> 2nd hunk of code uses the simple front end, and it works fine.
>
>
> public static void main(String[] args) {
>
> 	HelloWorldImplService hws = new HelloWorldImplService();
> 	HelloWorld hw = hws.getHelloWorldImplPort();
> 	String s = hw.sayHi("asdf");
> 	System.out.println(s);
>
> 	final String SERVICE_URL =
> "http://localhost:8080/hello/HelloWorld";
> 	ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
> 	factory.setServiceClass(HelloWorld.class);
> 	factory.setAddress(SERVICE_URL);
> 	HelloWorld helloWorldClient = (HelloWorld) factory.create();
> 	s = helloWorldClient.sayHi("asdf");
> 	System.out.println(s);
> }
>
>
> Here's the HelloWorld interface that was generated by java2wsdl (run
> from the maven plugin).  The one thing that is suspect is the
> targetNamespace for @WebResult is empty string.  I think it should be
> "http://test.twowire/".
>
> @WebService(targetNamespace = "http://test.twowire/", name =
> "HelloWorld")
> public interface HelloWorld {
>
>     @WebResult(targetNamespace = "", name = "return")
>     @RequestWrapper(localName = "sayHi", targetNamespace =
> "http://test.twowire/", className = "twowire.test.SayHi")
>     @ResponseWrapper(localName = "sayHiResponse", targetNamespace =
> "http://test.twowire/", className = "twowire.test.SayHiResponse")
>     @WebMethod
>     public java.lang.String sayHi(
>         @WebParam(targetNamespace = "", name = "arg0")
>         java.lang.String arg0
>     );
> }
>
>
> Here is the WSDL (which was generated via wsdl2java):
>
> <?xml version="1.0" encoding="UTF-8"
> standalone="no"?><wsdl:definitions xmlns:ns1="http://test.twowire/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> name="HelloWorldImplService" targetNamespace="http://test.twowire/">
>   <wsdl:types>
> <xsd:schema xmlns="http://test.twowire/"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://test.twowire/">
> <xsd:element name="sayHi" type="sayHi"/>
> <xsd:complexType name="sayHi">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="sayHiResponse" type="sayHiResponse"/>
> <xsd:complexType name="sayHiResponse">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="return" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="sayHiResponse">
>     <wsdl:part element="ns1:sayHiResponse" name="parameters">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="sayHi">
>     <wsdl:part element="ns1:sayHi" name="parameters">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:portType name="HelloWorld">
>     <wsdl:operation name="sayHi">
>       <wsdl:input message="ns1:sayHi" name="sayHi">
>     </wsdl:input>
>       <wsdl:output message="ns1:sayHiResponse" name="sayHiResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="HelloWorldImplServiceSoapBinding"
> type="ns1:HelloWorld">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="sayHi">
>       <soap:operation soapAction="" style="document"/>
>       <wsdl:input name="sayHi">
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="sayHiResponse">
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="HelloWorldImplService">
>     <wsdl:port binding="ns1:HelloWorldImplServiceSoapBinding"
> name="HelloWorldImplPort">
>       <soap:address
> location="http://localhost:8080/hello/HelloWorld"/> </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
>
>
> Thanks in advance!
>
>
>
> -----Original Message-----
> From: Liu, Jervis [mailto:jliu@iona.com]
> Sent: Tuesday, July 17, 2007 9:09 PM
> To: cxf-user@incubator.apache.org
> Subject: RE: attempting HelloWorld service, getting NULL return value
>
> Hi Marty, as you said, you've examined the message flowing between
> client and client and it is correct, in this case, must be sth wrong
> with your client. You may want to send us your client code, so that we
> can take a quick look to see what happened there.
>
> Thanks,
> Jervis
>
> -----Original Message-----
> From: Marty Saxton [mailto:msaxton@2wire.com]
> Sent: 2007?7?18? 3:35
> To: cxf-user@incubator.apache.org
> Subject: attempting HelloWorld service, getting NULL return value
>
>
> I am using CXF as both the client and server, and I'm just trying to
> get the following simple service working:
>
> @WebService
> public interface HelloWorld {
>     String sayHi(String text);
> }
>
>
> The implementation just returns "Hello " + text.  I examined the XML
> flowing between the client & server and it appears correct, the server
> is returning a correct message.  On the client side, using the jax-ws
> frontend, I get a null instead of a string for the return value.  I
> must be doing something terribly wrong, but I'm not sure where to
> begin debugging this problem.
>
> Thanks in advance!
>
>
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog