• Post Reply Bookmark Topic Watch Topic
  • New Topic

No response on server-side

 
Daniel Wolf
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I develop a web service with JAX-WS (2.1.2) on Tomcat5.5.
The client is a JAX-RPC running standalone (simply as a java main).
When I run the client, I get the following exception:

----------------------------- THE EXCEPTION -------------------------------
{http://xml.apache.org/axis/}stackTrace rg.xml.sax.SAXParseException: Document root element is missing.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.modelity.blogic.ratingmodel.assets.test.TestServicePortBindingStub.transform(TestServicePortBindingStub.java:157)
at TestMain.main(TestMain.java:16)
----------------------------- THE EXCEPTION -------------------------------

I wrote a handler on the client side, and saw that when the response is back, and I call the messageContext.getResponseMessage().getSOAPBody() I get the same "Document root element is missing." exception.

Now, I figured out there's simply a problem with how the server marshales the return object to the soap's xml.
Here is the schema:

----------------------------- THE SCHEMA -------------------------------
<xs:element name="transform" type="tns:transform" />
<xs:element name="transformResponse" type="tns:transformResponse" />
<xs:element name="transformReturn" type="tns:testObject" />
<xs:complexType name="transform">
<xs:sequence>
<xs:element name="number" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="transformResponse">
<xs:sequence>
<xs:element name="transformReturn" type="tns:testObject"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="testObject">
<xs:sequence>
<xs:element name="member" type="xs:int" />
</xs:sequence>
</xs:complexType>
----------------------------- THE SCHEMA -------------------------------

Here is tomcat's server-config.wsdd:

----------------------------- THE WSDD -------------------------------
<service name="TestService"
provider="java:RPC" style="wrapped" use="literal">

<operation name="transform" qname="ns1:transform"
returnQName="ns1:transformReturn" returnType="ns1:testObject"
soapAction="" xmlns:ns1="http://ws.assets.ratingmodel.blogic.modelity.com/">
<parameter qname="ns1:number" type="xsd:int" />
</operation>

<parameter name="allowedMethods" value="transform" />
<parameter name="typeMappingVersion" value="1.1" />
<parameter name="wsdlPortType" value="TestService" />
<parameter name="className"
value="com.modelity.blogic.ratingmodel.assets.test.TestService" />
<parameter name="wsdlServicePort" value="TestServicePort" />
<parameter name="wsdlServiceElement" value="TestService" />
</service>
----------------------------- THE WSDD -------------------------------

I use document-literal-wrapped of course.
As you can see in the schema, the service's method returns a complex object (that even contains java.util.Maps). When I change the return type to a simple object, such as String, everything works fine.

One last thing worth mentioning - I tried to write a handler at server-side using @HandlerChain but for some reason it didn't work (should I configure the handler chain somewhere besides the annotation and handler-chain file?). I also tried to use TcpMon to monitor the messages, but couldn't make it work (it didn't spot any transport in the ports I gave it).

I hope that's enough information (and not too much) and that someone can help me out.

Thanks a lot anyway!
Daniel
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Not sure what the problem is, but you should have no problems capturing the traffic using tcpmon. Did you configure the client to send the WS call to whatever port tcpmon is listening on, instead of to the server directly? (tcpmon is a proxy, not so much an "observer".)
 
Daniel Wolf
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!
I couldn't figure out it works as a proxy.
Changed it and inspected the transport - a request is sent correctly:

------------------------------ THE REQUEST -------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>
<transform xmlns="http://test.assets.ratingmodel.blogic.modelity.com/">
<number xmlns="">4</number>
</transform>
</soapenv:Body>
</soapenv:Envelope>
------------------------------ THE REQUEST -------------------------------

But no response!
Here's TcpMon output after the server is done:

------------------------------ TCPMON -------------------------------
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Mon, 17 Nov 2008 07:24:14 GMT
Connection: close
------------------------------ TCPMON -------------------------------

Those damn web services...
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case I'd take a look at the server log files; specifically, there should be something in the catalina.out file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!