| Author |
Unable to resolve target object:
|
Gurumurthy Ramamurthy
Ranch Hand
Joined: Feb 13, 2003
Posts: 272
|
|
Hi, I have written a simple web service: public class SoapService extends Object { /** Creates new SoapService */ public SoapService() { } /** This is the SOAP exposes method */ public String sayGreeting(String name) { return "Hello "+name; } } I have written an soap.xml file: <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:greetingService"> <isd rovider type="java" scope="Request" methods="sayGreeting"> <isd:java class="SoapService" static="false"/> </isd rovider> </isd:service> I have deployed this service in Tomcat: java org.apache.soap.server.ServiceManagerClient http://localhost:8080/soap/servlet/rpcrouter deploy soap.xml It is deplyed also. I have written a SOAP client: public class ClientClass { public static void main(String args[]) { String urlString = args[0]; String name = args[1]; // build a Call object Call call = new Call(); call.setTargetObjectURI("urn:greetingService"); call.setMethodName("sayGreeting"); call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); //creating a parameter list Vector params = new Vector(); params.addElement(new Parameter("name", String.class, name,null)); // adding the parameter(s) to the Call object call.setParams(params); // invoke the soap method Response res =null; try { res= call.invoke(new URL(urlString), ""); if( res.generatedFault()==false) { Parameter retValue = res.getReturnValue(); Object value = retValue.getValue(); System.out.println(value); }else { System.out.println("The faulty is: "+res.getFault().getFaultString()); } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SOAPException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } When I run this client: java clientclass http://localhost:8080/soap/servlet/rpcrouter yourname It gives me the error: Unable to resolve target object: SoapService Why? Any thoughts? Guru
|
 |
JeanLouis Marechaux
Ranch Hand
Joined: Nov 12, 2001
Posts: 906
|
|
Sounds like urn:greetingService does not exist as a defined service. Is it with Apache Soap ? if yes, check the dds.xml file
|
/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
|
 |
Gurumurthy Ramamurthy
Ranch Hand
Joined: Feb 13, 2003
Posts: 272
|
|
Yes, I am using APACHE SOAP only. BTW, what did you mean by dds.xml? Is that xml I have written for my app? It is soap.xml which contains: <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:greetingService"> <isd rovider type="java" scope="Application" methods="sayGreeting"> <isd:java class="com.tutorial.soap.guru.SoapService" static="false"/> </isd rovider> <isd:faultListener>org.apache.soap.server.DOMFaultListener </isd:faultListener> </isd:service>
|
 |
 |
|
|
subject: Unable to resolve target object:
|
|
|