You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by vivtops86 <vi...@nestgroup.net> on 2010/07/30 10:52:43 UTC

Calling remote web service

I have a web service located in a remote machine. I would like to call that
using JAVA client.  I searched in the forum and did what they said,but
getting an exception. Somebody please give me a sample code for accessing
the remote web service.
Thanks
Vivek
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Calling-remote-web-service-tp2307741p2307741.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Calling remote web service

Posted by BJ Freeman <bj...@free-man.net>.
Hi this is outside the scope of ofbiz mailing list.
if you can show a error that is return by ofbiz then we can help.

vivtops86 sent the following on 7/30/2010 2:27 AM:
>
> My JAVA web service client is:
>
> public static Map accessService(DispatchContext dctx, Map context) {
> 		String endPoint = "http://10.8.5.58:8080/webtools/control/SOAPService/";
> 		String inputParam = "Vivek";
> 		Map output=null;
> 		Call call;
> 		try {
> 			call = (Call) new Service().createCall();
> 			try {
> 				call.setTargetEndpointAddress(new URL(endPoint));
> 			} catch (MalformedURLException e) {
> 				// TODO Auto-generated catch block
> 				e.printStackTrace();
> 			}
> 			call.setOperationName(new QName("http://ofbiz.apache.org/service/",
> 					"learningFirstSoap"));
> 			call.addParameter("inputParam", org.apache.axis.Constants.SOAP_VECTOR,
> 					javax.xml.rpc.ParameterMode.IN);
> 			call.addParameter("outputParam",
> 					org.apache.axis.Constants.SOAP_VECTOR,
> 					javax.xml.rpc.ParameterMode.OUT);
> 			call.setReturnType(org.apache.axis.Constants.SOAP_VECTOR);
> 			try {
> 				Object responseWS=call.invoke(new Object[]{inputParam});
> 			} catch (RemoteException e) {
> 				// TODO Auto-generated catch block
> 				e.printStackTrace();
> 			}
> 			 output = call.getOutputParams();
> 			System.out.println("call invoked...");
>
>
> 		} catch (ServiceException e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}
>
> 		System.out.println("*******call.add parameterl********");
>
> 		return output;
>
> 	}
> I am getting "content not allowed in prolog" error at Object
> responseWS=call.invoke(new Object[]{inputParam}); statement

Re: Calling remote web service

Posted by vivtops86 <vi...@nestgroup.net>.
My JAVA web service client is:

public static Map accessService(DispatchContext dctx, Map context) {
		String endPoint = "http://10.8.5.58:8080/webtools/control/SOAPService/";
		String inputParam = "Vivek";
		Map output=null;
		Call call;
		try {
			call = (Call) new Service().createCall();
			try {
				call.setTargetEndpointAddress(new URL(endPoint));
			} catch (MalformedURLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			call.setOperationName(new QName("http://ofbiz.apache.org/service/",
					"learningFirstSoap"));
			call.addParameter("inputParam", org.apache.axis.Constants.SOAP_VECTOR,
					javax.xml.rpc.ParameterMode.IN);
			call.addParameter("outputParam",
					org.apache.axis.Constants.SOAP_VECTOR,
					javax.xml.rpc.ParameterMode.OUT);
			call.setReturnType(org.apache.axis.Constants.SOAP_VECTOR);
			try {
				Object responseWS=call.invoke(new Object[]{inputParam});
			} catch (RemoteException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			 output = call.getOutputParams();
			System.out.println("call invoked...");


		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		System.out.println("*******call.add parameterl********");

		return output;

	}
I am getting "content not allowed in prolog" error at Object
responseWS=call.invoke(new Object[]{inputParam}); statement
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Calling-remote-web-service-tp2307741p2307766.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Calling remote web service

Posted by BJ Freeman <bj...@free-man.net>.
not enough information, please be more specific related to ofbiZ
Version of source code
SVN version of trunk
what you trying to accomplish in ofbiz.

Most sample code is in the beginners tutorial
https://cwiki.apache.org/OFBIZ/ofbiz-tutorial-a-beginners-development-guide.html
or in  the
framework\example
and
framework\exampleext

lastly do a google on
ofbiz web services
you will get many hits including past emails on the subject.


vivtops86 sent the following on 7/30/2010 1:52 AM:
>
> I have a web service located in a remote machine. I would like to call that
> using JAVA client.  I searched in the forum and did what they said,but
> getting an exception. Somebody please give me a sample code for accessing
> the remote web service.
> Thanks
> Vivek