You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Arcadius A." <ah...@sh.cvut.cz> on 2003/12/21 02:33:14 UTC

Interoperability troubles: Axis sending text/plain

Hello!
I'm doing some experiments about webservices interoperability using
Axis, Weblogic and .NET.

I'm building a relatively simple webservice. It's a service that provides
informations about registered users in a database.
I have several implementation of the service.

For the webservice, I use a class Person (a bean having setter/getter for
all of its fields) and a class dp, that contains methods returning array
of person( Person[] ).

1)The first implementation of my service provider was done on
Weblogic8.1 and it's
working quite fine. The corresponding WSDL generated by weblogic can be
found at:
http://ahouans.sh.cvut.cz/tmp/wl.wsdl

2)The next was a .NET implementation.
That one works fine too.
The corresponding WSDL file is available at:
http://ahouans.sh.cvut.cz/tmp/net.wsdl

3) I've used the WSDL from Weblogic to generate client code for VS.NET
and Axis1.1(in JBuilder). The Axis client works well with the weblogic
server implementation as well as with the .NET implementation. The .NET
client works well with both weblogic and .NET too.

4) Now, I'm willing to implement a tomcat provider of the same service.
The Java classes used are quite similar to the one of weblogic. but the
WSDL generated from the DP classe looks different. it can be seen at:
http://ahouans.sh.cvut.cz/tmp/axis02.wsdl
The provider is deployed on Tomcat4.1  and it seems OK.
Now, I'm trying to access the showAllUsers(a method that takes no
parameter and returns Person[]) using the two clients I've built before.
 4-1) The .NET client complains saying:

"Client found response content-type of 'text/plain', but expected
'text/xml'"

 4-2) The Axis client complains. The stacktrace is:

<axisClientStacktrace>
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: org.xml.sax.SAXParseException: Document root element is
missing.
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXParseException:
Document root element is missing.
    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3170)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:501)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
    at 
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242) 

    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
......
</<axisClientStacktrace>

4-3) In order to see what is going on on the wire, I have used TCPmon.
The request for the method that displays all users in the DB is:

POST /dpWeb/services/DP HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "http://www.openuri.org/showAllUsers"
Content-Length: 317
<?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>
  <showAllUsers xmlns="http://www.openuri.org/"/>
 </soapenv:Body>
</soapenv:Envelope>



And the response is:

HTTP/1.1 200 OK
Content-Type: text/plain
Date: Sun, 21 Dec 2003 00:05:35 GMT
Server: Apache Coyote/1.0
Connection: close


So, it seems that not all the response is sent back to the client.
I have written some system.out.println() on the server and noticed that
the client calls correctly the method on the server; on the server, I
can get the result printed out. But somehow, It isn't correctly sent
back to the client!

Any idea about what I'm doing wrong?
I know I could use the WSDL generated by the axis provider to generate
build a new axis client, but I wish I could use the two clients I've
already built.
So, please any idea about what changes I have to do in order to fix this
problem?

Thanks in advance.

Arcadius.
PS: I apologize for the long message.





Axis Response question.

Posted by "Arcadius A." <ah...@sh.cvut.cz>.
Hello!
Let's assume that I have a simple echo WS provider.

When called,axis would return a response like this:

<ns:EchoResponse xmlns:ns="http://myuri.com/">

<ns:Echo*Return*>Hello!!!</ns:Echo*Return*>

</ns:EchoResponse>

Is there a way I could change  the *Return*  suffix to *Result*?
ie.
<ns:EchoResponse xmlns:ns="http://myuri.com/">

<ns:Echo*Result*>Hello!!!</ns:Echo*Result*>

</ns:EchoResponse>

?
Thanks.

Arcadius.



Re: Interoperability troubles: Axis sending text/plain

Posted by "Arcadius A." <ah...@sh.cvut.cz>.
Arcadius A. wrote:

> So, it seems that my problem is the serializer/deserializer on the 
> server :-( 

Here is my deploy.wsdd file :

<?xml version="1.0" encoding="UTF-8"?>
<deployment
    xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:ns="http://www.openuri.org"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  <service name="DP" provider="java:RPC" style="document" >
      <parameter name="className" value="cz.cvut.sh.ahouans.DP"/>
      <parameter name="allowedMethods" value="addUser findByBirthMonth 
findByBirthYear findByCity findByCountry findByEmail findByGender 
findByLastname findByUserId findByUsername isValidUser showAllUsers 
unsubscribe "/>
      <parameter name="scope" value="Request"/>

  <typeMapping
    xmlns:ns="http://www.openuri.org"
    qname="ns:Person"
    type="java:cz.cvut.sh.ahouans.Person"
    serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
    deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  />

  <typeMapping
    xmlns:ns="http://www.openuri.org"
    qname="ns:ArrayOffPerson"
    type="java:cz.cvut.sh.ahouans.Person[]"
    serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
    deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  />
  </service>
</deployment>

Please, is the WSDD file correct for my service?

Thanks.

Arcadius.



Re: Interoperability troubles: Axis sending text/plain

Posted by "Arcadius A." <ah...@sh.cvut.cz>.
Arcadius A. wrote:

> Hello!
> I'm doing some experiments about webservices interoperability using
> Axis, Weblogic and .NET.


Some more information about my previous post:

Now, I'm calling a method that takes two inputs strings and returns a 
boolean type.

The request is:


Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "http://www.openuri.org/isValidUser"
Content-Length: 390
<?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>
  <isValidUser xmlns="http://www.openuri.org/">
   <username>haha</username>
   <password>hoho</password>
  </isValidUser>
 </soapenv:Body>
</soapenv:Envelope>


And the response from TCPmon  is:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Date: Sun, 21 Dec 2003 02:01:46 GMT
Server: Apache Coyote/1.0
Connection: close
<?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>
  <soapenv:Fault>
   <faultcode>soapenv:Server.userException</faultcode>
   <faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered 
a child element, which is NOT expected, in something it was trying to 
deserialize.</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>


So, it seems that my problem is the serializer/deserializer on the 
server :-(

Regards.

Arcadius.