Skip to main content

Accessing webservice gives SOAPFaultException error

3 replies [Last post]
super_raj
Offline
Joined: 2007-11-24
Points: 0

I have written a webservice and deploying it onto sun app server. Now when I accessing the service from client it gives me following error.

I am helpless as I tried to redeploy the service, restarting server etc bt could nt make it work. Actually, I am a newbie in this field I can not think of possible issues that give such error.

FYI. Eventhough I dont have any fault handling code at serverside it gives me error.

javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException
at com.sun.xml.internal.ws.encoding.soap.ClientEncoderDecoder.toMessageInfo(ClientEncoderDecoder.java:86)
at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.toMessageInfo(SOAPXMLDecoder.java:211)
at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:540)
at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:260)
at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:139)
at com.sun.xml.internal.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:86)
at com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:174)
at com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:108)
at $Proxy21.convertAddress(Unknown Source)
at com.example.clientside.client.main(client.java:92)

Any help would be appreciated
rp

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dtrprasad
Offline
Joined: 2005-01-29
Points: 0

Hello friend,

i am writing this after seeing a tutorial.

i had used annotations to simplify webservice development.

i will write how it could be done .

set classpath to include tools.jar and javaee.jar of glassfish.

write one one webservice like

package com.htc.javaee.wservices;

import java.io.Serializable;
import java.util.HashMap;
import javax.jws.WebService;

@WebService
public class PriceQuoter implements Serializable
{
HashMap map;

public PriceQuoter()
{
map =
new HashMap();
map.put("ABB",new Double(412.15));
map.put("ACC",new Double(304.5));
map.put("Reliance",new Double(286.5));
map.put("Bajaj",new Double(321.5));
}

public double getShareQuote(String co)
{
double ret = 0.0;
if(map.containsKey(co))
{
ret = map.get(co);
}
return ret;
}

}

compile and place into your domain

c:\pra_sun\ws1>javac -d c:\glassfish\domains\domain1\autodeploy PriceQuoter.java

this will deploy web-service (check from admin-console)

get the stubs by running

c:\pra_sun\ws1>wsimport -d . http://localhost:9080/PriceQuoter/PriceQuoterService?WSDL

this will provide required classes

write the client as
package wsclients;

import javax.xml.ws.WebServiceRef;
import com.htc.javaee.wservices.PriceQuoter;
import com.htc.javaee.wservices.PriceQuoterService;

public class PriceQuoteClient
{
@WebServiceRef
(wsdlLocation=
"http://localhost:9080/PriceQuoter/PriceQuoterService?WSDL")
static PriceQuoterService service;

public static void main(String[] args)
{
PriceQuoteClient client = new PriceQuoteClient();
double result = 0.0;
try
{
if(service != null)
{
PriceQuoter quoter = service.getPriceQuoterPort();
result = quoter.getShareQuote("ABB");
}
else
{
System.out.println("No Service");
}
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println("ABB's share Quote Price:"+result);
}

}

and run it as

c:\pra_sun\ws1>appclient wsclients.PriceQuoteClient

super_raj
Offline
Joined: 2007-11-24
Points: 0

I would really appreciate any kind of directions... please

oleksiys
Offline
Joined: 2006-01-25
Points: 0

Hello,

please try to ask on Metro forum [1].

WBR.