Solved

SOAP error

Posted on 2007-04-06
28
521 Views
Last Modified: 2012-05-05
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)
0
Comment
Question by:desiboy1974
  • 15
  • 12
28 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18863471
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 :)
0
 

Author Comment

by:desiboy1974
ID: 18863516
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 ....
0
 

Author Comment

by:desiboy1974
ID: 18863573
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");
       
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18863582
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 :)
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18863595
No No !! when u created the client did it generate the proxy class or not????/

Use the proxy class
0
 

Author Comment

by:desiboy1974
ID: 18863600
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...
0
 

Author Comment

by:desiboy1974
ID: 18863607
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

0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18863646
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");

0
 

Author Comment

by:desiboy1974
ID: 18863698
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..
0
 

Author Comment

by:desiboy1974
ID: 18863780
so when i ran the wsdltojava command, it generated these files

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


0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18863795
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 :)

0
 

Author Comment

by:desiboy1974
ID: 18863825
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
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18863885
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

0
 

Author Comment

by:desiboy1974
ID: 18864049
you mean in the soapbindingimplementation class?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 30

Expert Comment

by:mayankeagle
ID: 18864069
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.
0
 

Author Comment

by:desiboy1974
ID: 18864202
no..its running locally...i am already throwing the exception in the implementation class..the only exception it throws is

java.lang.reflect.InvocationTargetException



        
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18864966
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.
0
 

Author Comment

by:desiboy1974
ID: 18867707
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
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18868585
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 ????
0
 

Author Comment

by:desiboy1974
ID: 18868797
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18868812
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.
0
 

Author Comment

by:desiboy1974
ID: 18868841
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 ..
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18868855
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.
0
 

Author Comment

by:desiboy1974
ID: 18868865
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..
0
 

Author Comment

by:desiboy1974
ID: 18869438
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?
0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 500 total points
ID: 18871261
Check you Tomcat logs see whats happening.

so now your webservice is also not running is it????????

If thats the case best way is to start over again instead of trying to debug some unknown Exception.

If you are planning to start over please use Eclipse WTP version there u just need to right ur java class and u can directly expose it as a webservice. And also can generate the client right there.
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 18909550
What happend desiboy? I was not in town for three days is you problem resolved?
0
 

Author Comment

by:desiboy1974
ID: 18928987
yes..i reinstalled everything fom scratch and it all worked fine..thanks for guiding me..
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now