Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now you can view the wsdl file of the servie servicee by navigating to the service engine tools application again and now click on the service name and you can see “Export wsdl” next to the service name . Click on it will display the wsdl definition.

Also you need to get the SOAP link as it is given as end point to the java client to call the web service from outside application.

So the link is usualy available under:

http://your_hostname/webtools/control/SOAPService

...

Now create the service java file and add the webservice content to it.

Code Block

public String ServiceCall (String OrderId) {
	String output=null;
	String endpoint,inputParam, username, password;
	inputParam= OrderId;
	try{
		endpoint = "http://hostname:8080/webtools/control/SOAPService";
		username="admin";
		password="ofbiz";
		Call call = (Call) new Service().createCall();
		call.setTargetEndpointAddress(new URL (endpoint));
		call.setOperationName(new javax.xml.namespace.QName("getOrderStatus"));
		call.addParameter ("orderId", org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
		call.addParameter("login.username", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
		call.addParameter("login.password", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
		call.setReturnType(org.apache.axis.Constants.SOAP_STRING);
		Object response = call.invoke(new Object[]{inputParam,username,password});
		output = (String) response;
		try{
			System.out.println(output);
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}catch(Exception e){
		e.printStackTrace();
	}
	return output;
}

...