Hi all,
I am trying at the moment to develop an Axis2 server, and test it with a client.
The server is to provide a soap wsdl service, returning an object request.
I have generated server code and client code using axis2's wsdl2java tool, and all seemed fine.
The server I created using this generated code seems to work, so far as i can tell, as I can connect to it through a browser.
For example, using the browser I can connect to it via:
http://localhost:8888/services/PersonInfo
and it gives me a page showing 'Deployed Services', listing the operations available.
but the funny thing is here that it seems to auto-direct me to another url: http://localhost:8888/axis2/services/ which I have not specified.
For the server I am using the axis2 supplied SimpleHTTPServer. Here is the complete code excluding the actual generated code:
public class EmbeddedAxis2Server {
public static void main(String[] args) throws Exception {
ConfigurationContext context = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null, null);
AxisService service =
AxisService.createService(caps.integration.rhos.dk.schema.astraiaservice._2008._04._15.PersonInfo.class.getName(), context.getAxisConfiguration());
context.getAxisConfiguration().addService(service);
SimpleHTTPServer server = new SimpleHTTPServer(context, 8888);
server.start();
}
}
I can even call the published operation using the browser, via the url:
http://localhost:8888/axis2/services/PersonInfo/getPersonInfo
and pass in arguments using the usual form variables syntax.
HOWEVER!! My problem is (and maybe it is related to the url redirect strangeness I mentioned above, or maybe not), that my coded client is not able to connect.
I generated the client stubs also using wsdl2java, and call the functions... but I get this show stopping exception:
org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) 127.0.0.1/services/PersonInfo
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at caps.integration.rhos.dk.schema.astraiaservice._2008._04._15.PersonInfoStub.getPersonInfo(PersonInfoStub.java:142)
at com.astraia.axisclient.Client.getPersonInfo(Client.java:44)
at com.astraia.axisclient.Client.main(Client.java:23)
Here is the client code (excluding generated stub)
public static void getPersonInfo(){
try
{
ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
PersonInfoStub stub =new PersonInfoStub(context);
GetPersonInfoIn req =new GetPersonInfoIn();
req.setCivilRegistrationIdentifier("CIV123");
req.setHospitalCode("HOS123");
req.setRequestId("123");
req.setUserName("sean");
GetPersonInfoOut res = stub.getPersonInfo(req);
System.out.println(res.toString());
} catch(Exception e){ e.printStackTrace(); System.out.println("\n\n\n"); }
}
If anyone has any idea of what this problem is about, I would love to hear about it!
Kind Regards,
svaens
Edited by: svaens on Apr 28, 2008 2:11 AM