Skip to main content

@WebService class, when it integrates an application, SoapFaultException

3 replies [Last post]
ms_sasikumar
Offline
Joined: 2006-06-05

Hi,

I have two piece of programs.

1. A simple web service program using jax-ws 2.0. which is working fine.

2. I have another program, which takes an xml as input and creates a socket ++ and gets me output data as xml. That is also working fine.

Now, when I call the second program from the first one ie. from a WebService server side program, it gives me SOAPFaultException.

Can any one help me.

Thanks in advance.
Sasi.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
prisca
Offline
Joined: 2006-03-30

Hi,

see Kathy advice, as answer to another post :
http://forums.java.net/jive/thread.jspa?threadID=16222&tstart=0

Catching the exception will allow you to see from where it is thrown :

[i][b]catch(SOAPFaultException Se)
{
SOAPFault fault = Se.getFault();
System.out.print("SOAPFaultException thrown, fault is : "+fault.toString());
}[/b][/i]

Prisca.

ms_sasikumar
Offline
Joined: 2006-06-05

Prisca,

Thank you very much for your reply.

I think, I have not described my entire environment. In my SoapFaultException Se, Se has no getFault() method at all.

So let me describe everything, whatever I can.

I am using:
-----------
jdk1.5.0_06
JRE System Library[jdk1.5.0_06]
Tomcat 5.5.17
jax-ws 2.0 Reference Implementation (RI) version: 2.0_01 fcs

In addition to my previous description, I can also say that I am able to send xml and receive xml. When I attach my real program, which should send back an xml but the following error comes. (What it is suppost to return as xml, the same xml I tried to send it from server to client by hardcoding. It is working.)

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unknown fault type:class java.lang.NoClassDefFoundError
[java] at com.sun.xml.ws.encoding.soap.ClientEncoderDecoder.toMessageInfo(ClientEncoderDecoder.java:84)
[java] at com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toMessageInfo(SOAPXMLDecoder.java:209)
[java] at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:538)
[java] at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:258)
[java] at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:137)
[java] at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:84)
[java] at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:172)
[java] at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:106)
[java] at $Proxy16.getConsumerInfo(Unknown Source)
[java] at client.ConsumerAddressClient.main(ConsumerAddressClient.java:23)
[java] Java Result: 1

Server.
-------------------------------------------------------
@WebService
public class Consumer {
@WebMethod
public String getConsumerInfo(String inputXml)
{
String returnXml = getStuff(inputXml);
return returnXml;
}

public String getStuff( String inputXml)
{
testClass t = new testClass();
String returnXml = t.getData(inputXml);
return returnXml;
}
}

public class testClass {
public String getData(String inputXml)
{
String result = null;
MessageTranslator mTrans = new MessageTranslator(); // it connects another server and gets data
result = mTrans.process(inputXml,1); // it returns an xml
return result;
}
}
-------------------------------------------------------
Client
--------
public class ConsumerAddressClient {

public static void main(String[] args)
{
String inputXml = ""
+ ""
+ "1"
+ "27"
+ "56"
+ "***133710"
+ ""
+ "-240"
+ "0"
+ "0"
+ "1"
+ "99"
+ "
";
Consumer port = new ConsumerService().getConsumerPort();
String ConsumerInfo = port.getConsumerInfo(inputXml);
System.out.println();
System.out.println("Result of getConsumerInfo");
System.out.println("-------------------------");
System.out.println( ConsumerInfo );
}
}

ms_sasikumar
Offline
Joined: 2006-06-05

Hi,

It is working now. The problem was due to xmlbeans, which was used inside my application.

Sasi.