cancel
Showing results for 
Search instead for 
Did you mean: 

Invoking Webservice from Java Application

Former Member
0 Kudos

Hello All,

I am trying a POC where I need to call a webservice (Developed in ABAP and published) from a standalone java application.

I have created WebService Standalone Proxy. I am following the step required to call the same as mentioned in the URL - [Invoke Webservices|http://www.ibm.com/developerworks/webservices/library/ws-javaclient/index.html].

When I created a Webservice proxyfollowing class gets created -

1) Logincal Port

2) Proxy Classes

3) SEIs

4) WSDL Files.

I have created a main class and imported the above file as jar. I have writtend following code in my main class -

String namespace = "urn:sap-com:document:sap:soap:functions:mc-style";

String serviceName = "CheckSso";

String wsdlURL =

"http://localhost:8001/sap/bc/srt/rfc/sap/CHECKSSO?sap-client=180&wsdl=1.1";

try {

QName qname = new QName(namespace, serviceName);

ServiceFactory SF = ServiceFactory.newInstance();

DefaultService service =

(DefaultService) SF.createService(new URL(wsdlURL), qname);

CheckSso flight = service.getLogicalPort();

service.createCall();

} catch (MalformedURLException e) {

e.printStackTrace();

} catch (ServiceException e) {

e.printStackTrace();

}

When I try to run the above code - I got following error-

javax.xml.rpc.ServiceException: java.lang.ClassNotFoundException: com.sun.xml.rpc.client.ServiceFactoryImpl

at javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:65)

at com.abhi.src.CheckSSo.main(CheckSSo.java:39)

It seems some implementation class is missing. Can anyone guide me if i am missing anything in the steps above.

Thanks

Abhinav Sharma

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Abinap.

If you are woking with JEE 1.3 or JAX-RPC.

You need to add some libraries to java project.

Go to the tab "Add Libraries" on context menu of the project: Properties --> Java build Path

Select "Add variable" button, after select the SAP_WEBSERVICES_EXT_LIBS_HOME variable and click on "Extend" Button, finally select all the libraries under lib folder, do the same to the SAP_XML_TOOLKIT_LIBS_HOME variable.

Greetings.

Manuel Loayza Gahona

Former Member
0 Kudos

Hi Abhinav,

You will need more jars in your classpath to run the standalone java application. Try to search for the jars in IBM WebSphere SDK for Web Services (WSDK) v5.1 from the URL you provided.

Regards,

Min