This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes SOAPFaultException on anyType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAPFaultException on anyType" Watch "SOAPFaultException on anyType" New topic
Author

SOAPFaultException on anyType

graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Can someone help me decipher the meaning of the following:


Completely Confused!


write, revise, re-write, revise, again...<br />write, revise, re-write, revise, again...
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2921
    
    5
Well, that is precious little information but anyway...

The XML schema type anyType could be any well-formed XML. So as such there is no automatic mapping to a Java type.

However JAX-RPC is supposed to map that to javax.xml.soap.SOAPElement. JAX-WS should map it to org.w3c.dom.Element.

Tip: xsd:any: A cautionary tale
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133

The disadvantage of xsd:anyType is that JAX-RPC does not define a mapping for it. So even if a vendor maps this XML type, you cannot write portable code which uses it.


The service that I'm using is from a client so, I guess, the choice of data structures within the wsdl is not up to me.

The error itself seems really vague. Could this be a versioning issue? I believe I'm using an older implementation of the wsdp: jwsdp-1.3. The application server is JBoss-4.0.3 (their first version which handles ComplexTypes correctly). The jdk is: 1.4.2_13.

This is the first time I've had to use the anyType struct and it's used throughout the web-service:


Any other ideas on what's going wrong?
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Looks like JBoss was the problem.

Looks to be resolved, see:
JBoss Forum
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2921
    
    5
Originally posted by graham king:
Looks like JBoss was the problem.

Looks to be resolved


That is not how I read it. The problem is the JWSDP 1.3.
To fix it you need to get rid of the JWSDP 1.3 and upgrade the JBoss server to a version that supports jbossws-native-2.0.0.GA .

JWSDP 1.6 (which may or may not fix your problem) was the most recent JWSDP that only needed JDK 1.4.
However Sun Microsystems has withdrawn that download (only JWSDP 2.0 is available which requires JDK 1.5)

However a JWSDP 1.6 download was reported at http://repository.jboss.org/sun-jwsdp/1.6/
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Originally posted by Peer Reynders:


That is not how I read it. The problem is the JWSDP 1.3.
To fix it you need to get rid of the JWSDP 1.3 and upgrade the JBoss server to a version that supports jbossws-native-2.0.0.GA .

JWSDP 1.6 (which may or may not fix your problem) was the most recent JWSDP that only needed JDK 1.4.
However Sun Microsystems has withdrawn that download (only JWSDP 2.0 is available which requires JDK 1.5)

However a JWSDP 1.6 download was reported at http://repository.jboss.org/sun-jwsdp/1.6/


Thanks, I'll give it a shot.
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Well, I've gotten further, I think, to accomplishing at least one call to their web-service.

Here's the current setup:
JBoss-4.0.5.GA
jbossws-native-2.0.1.GA
jwsdp-2.0
jdk 1.5.0_13-b05

It looks like I'm able to send a request across the wire, but, I still receive what appears to be close to the same error; just churched up a bit with the xml:

The whole thing:


And here's the error after the fact:


Does it look like I'm making any progress or have I gone full circle ending with the same thing?

Am I sending the request properly by creating my own XML or do I need to create using some magic SOAP objects?

Need some help in more ways than one,
Graham
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2921
    
    5
Originally posted by graham king:
Here's the current setup:
JBoss-4.0.5.GA
jbossws-native-2.0.1.GA
jwsdp-2.0
jdk 1.5.0_13-b05


If you have JBossWS why do you also have the JWSDP? Installing JBossWS can't fix anything that may be potentially wrong with the JWSDP - you actually have to use JBossWS instead.

Let me see if I understand your setup: your JBoss server is a web services client to a web service implemented with a Microsoft web service toolkit. Also the client stub being used on the JBoss seems to have no problem assembling the SOAP request - however you now get a SOAP response that indicates that the server has problems with the content of the element with an xsd:anyType data type.

If that is a fair assessment of your situation then your are going to have to take a closer look at the contents of that xsd:anyType element in the SOAP request payload. I'm assuming that the web service itself "is working", i.e. that it can't be a problem on the service server end.

Take a look at the SOAP request that your client stub is sending out. Is the content of the xsd:anyType well formed XML? Even if it is well formed, it could still be invalid with reference to the XML schemas that the server is using.

Remember that the WSDL does not place any specific constraints on the content of xsd:anyType and xsd:any. What is valid inside these elements has to be established outside of the WSDL contract. Therefore the generated code cannot help you to make sure that the content of these elements is in fact something that the web service server can process.

Try to come up with the simplest SOAP request possible (i.e. extremely simple info in the xsd:anyType element) and see if you can get it to work. Once you get it to work, make it more and more complex until you run into problems again - that should give you an idea what needs to be fixed.

At this point I would be inclined to take the application server out of the equation entirely while I'm exploring the client server interaction and simply write a command line program that is using the generated stubs. The JWSDP wscompile creates client stubs that will work outside of an application server and I wouldn't be surprised if JBossWS can do the same thing.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SOAPFaultException on anyType
 
Similar Threads
SOAPMessage Frights
How to preserve new lines when parsing
jwsdp 2.0 unable to deserialize SoapFault from axis webservice
SUN ONE APPLICATION SERVER 7.0 && JUDDI
deserialization error: XML reader error: unexpected character content: "<?xml version='1.0' ?>