Link to home
Start Free TrialLog in
Avatar of desiboy1974
desiboy1974

asked on

SOAP error

can someone help me out here..i keep getting error trying to invoke a web service using axis on apache...

Exception in thread "main" AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.reflect.InvocationTargetException
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}hostname:000372d

java.lang.reflect.InvocationTargetException
        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
.java:222)
        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
java:129)
        at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ
ationContext.java:1087)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
nt(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanEndElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
nknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
Context.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
        at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j
ava:796)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        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 emailAccountServices.ws.EmailAccountServicesSoapBindingStub.findEmail
Accounts(EmailAccountServicesSoapBindingStub.java:470)
        at com.peopletelecom.appservices.SwiftServices.Test.main(Test.java:56)
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

What exactly are you trying to do????? in the sense what kind of webservice are u trying to axis and when are u getting ths fault if u can be clear It will be easier for us to help :)
Avatar of desiboy1974
desiboy1974

ASKER

this is when i run the client class that invokes the service....so i'm invoking the web service soapbinding implementation class...these classes were created after generating the proxy classes...

so when i run the command

java -cp ....
so  in the client test.java below...i invoke the service emailAccountServices...the error happens on the last line...

emailAccountServices.ws.EmailAccountAppServicesService service =
                new emailAccountServices.ws.EmailAccountAppServicesServiceLocator();
        System.out.println("After Make a service");
       
        // Now use the service to get a stub to the service
        System.out.println("Before use the service to get a stub to the service");

        emailAccountServices.ws.EmailAccountAppServices _eas = service.getemailAccountServices();
        System.out.println("After use the service to get a stub to the service");
       
        java.lang.Object[] a = _eas.findEmailAccounts("0892288950");
       
How did u generate the proxy ??? using WSDL2Java? then what u did ????

U need to use the proxy class instance and invoke a particular operation.

I think u are trying to invoke a findEmailAccounts Operation.

If i am correct then first check is the Web Service up and running. Use some generic client like the open which comes with Eclipse WTP package to check that :)
No No !! when u created the client did it generate the proxy class or not????/

Use the proxy class
yes..i generated the proxy using

java -cp $AXISCLASSPATH org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -S true -Nurn:emailAccountServices emailAccountServices.ws emailAccountServices.wsdl

yes..the webservice is up and running...
WSDL2java generated the stubs....

i'm not sure i understand "when u created the client did it generate the proxy class "...

the proxy classes got generated using the

java -cp $AXISCLASSPATH org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -S true -Nurn:emailAccountServices emailAccountServices.ws emailAccountServices.wsdl

Yes there will a Particular class file name ending with the term Proxy just check for that if u find it then create some thing like this.

xxxProxy proxy = new xxxProcy();

proxy.findEmailAccounts("2323253");

i checked...there is no class file with the name Proxy..when i used the WSDLto java command, it generated a soapbindingimplentation class, servicelocator, soapbindingskeletion and soapbindingstub class...i followed exactly this link...

http://www.resc.rdg.ac.uk/twiki/bin/view/Resc/SimpleGuideToDeployingWebServices

it mentions nothing of a proxy class getting created..
so when i ran the wsdltojava command, it generated these files

EmailAccountAppServices.class
EmailAccountAppServicesServiceLocator.java
EmailAccountServicesSoapBindingSkeleton.java
EmailAccountServicesSoapBindingStub.java


Ok got it :) now tell me what all jars are there in you classpath there must be min of 6 jars like

axis.jar, saaj.jar, commos-logging.jar,commons-Diescovery.jar, wsdl4j.jar and finally jaxRpc jaar please chek if commons-Diescovery.jar is missing i think thats the problem.

Your approach is also  correct so go ahead and check the jars :)

this is the command that runs...it does include all the jards

java -cp "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\classes;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\axis.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\jaxrpc.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\commons-logging-1.0.4.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\commons-discovery-0.2.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\log4j-1.2.8.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\saaj.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\wsdl4j-1.5.1.jar;C:\ProgramFiles\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\xerces.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\activation.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis\WEB-INF\lib\emailAccountServices.jar"  Test
that fishy every thing seems to be in place.

Actually when u try use the service locater it throws back a throwable just try catching and print it it may help u

http://forum.java.sun.com/thread.jspa?threadID=522422&messageID=2500244

get back with what it says

you mean in the soapbindingimplementation class?
If the web service is on the Internet, you might need to authenticate yourself at the HTTP proxy (if you use one) to connect to it.
no..its running locally...i am already throwing the exception in the implementation class..the only exception it throws is

java.lang.reflect.InvocationTargetException



        
Ok desiboy do one thing

Try the other way of invoking the webservice as mentioned  in the link you provided.

http://www.resc.rdg.ac.uk/twiki/bin/view/Resc/SimpleGuideToDeployingWebServices

Or else try invoking it via the Eclipse Test webservices client and see if you are able to make a web service call successfully.

Please get back once you are done with it.
i tried both methods..exactly the same error?

i am using the xercesImpl.jar instead of the xerces jar..would that make any difference?

Thanks
I don't think so the actual problem is that its not able to find the Invocation target i.e your web service.

You told me that ur webservice is up and running how did u check that ????
no thats not sufficient try to make a web service call from eclipse inbuit Web service Client and check. Because i think the exception is occurring at the server end not the client end just check that.

And also if possible check the log of Tomcat for the correct exception.
its really weird..now i get  a null pointer exception when processing the deploy.wsdd file..the only change i made was add xml-api.jar to the lib directory..

Processing file emailAccountServices/ws/deploy.wsdd
Exception: AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}hostname:000372d

i have checked the tomcat logs..nothing at all in that ..
Ya thats real weird.
By the way you don't need xml-api.jar. Any way now remove that jar and check if ur service is working.
i removed the jar and it still gives me th null pointer exception ..i regenerated the stubs, restarted tomcat..still no change....dont undestand whats going on..
i tried creating another web service and go the same null pointer error again?...

is there any other way of processing the deploy.wsdd file to see where the errors occurs?
ASKER CERTIFIED SOLUTION
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What happend desiboy? I was not in town for three days is you problem resolved?
yes..i reinstalled everything fom scratch and it all worked fine..thanks for guiding me..