SOAP deployment --> JAVA
Hi all,There is something wrong with my deployment. I cant get this to work :-( I\'ve made a simple Test-class:
public class Test {
String first = \"\";
String last = \"\";
public Test(String f, String l) {
first = f;
last = l;
}
public String toString() {
return \"\" + first + \" \" + last;
}
}
This Test-class, I want to return to my client, when the client invokes the
getTest-method on my server(HelloAdvancedSoapServer) which is deployed on
the SOAP admin tool. View the HelloAdvancedSoapServer hereunder:
public class HelloAdvancedSoapServer {
public Test getTest(String f, String l) {
Test test = new Test(f, l);
System.out.println(test);
return(test);
}
}
My SOAP client looks like this, and I know for sure, that it passes the
arguments OK, but it doesnt get a response:
// Contacts Soap Server to get a greeting.
import java.net.* ;
import java.util.* ;
import org.apache.soap.* ;
import org.apache.soap.rpc.* ;
import org.apache.soap.encoding.* ;
import org.apache.soap.encoding.soapenc.* ;
public class HelloAdvancedSoapClient {
public static void main(String[] args) throws Exception {
String f = \"Robert\" ;
String l = \"Yeah right\" ;
String host = \"localhost\" ;
String port = \"8080\" ;
URL url = new URL(\"http://\" + host + \":\" + port
+ \"/soap/servlet/rpcrouter\") ;
Call call = new Call() ;
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC) ;
call.setTargetObjectURI(\"urn:HelloAdvancedSoapServer\") ;
call.setMethodName(\"getTest\") ;
Vector v = new Vector() ;
v.addElement(new Parameter(\"f\", String.class, f, null)) ;
v.addElement(new Parameter(\"l\", String.class, l, null)) ;
call.setParams(v) ;
try{
Response resp = call.invoke(url,\"\") ;
if(resp.generatedFault()) {
System.out.println(\"Error: Something went wrong.\");
}else {
Parameter p = resp.getReturnValue() ;
Object o = p.getValue();
}
}catch(SOAPException e) {
System.err.println(\"Uh-Oh!\") ;
System.err.println(\"Faultcode:\" + e.getFaultCode()+\"\\n\") ;
System.err.println(\"Message from SOAPException: \" + e.getMessage()
+ \"\\n\") ;
System.out.println(e) ;
}
}
}
I think I have deployed the server wrong!!! What should I do to make the
DeploymentDescriptor.xml? Which settings should I set in the type mapping
part of the SOAP admin tool?
Any help appriciated...
Cheers
Allan Lauridsen
ProActive Consulting A/S
Denmark