cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marty Saxton" <msax...@2wire.com>
Subject RE: attempting HelloWorld service, getting NULL return value
Date Wed, 18 Jul 2007 17:44:57 GMT
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

Mime
View raw message