cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming Webservice in JAVA

Former Member
0 Kudos

Hi Group,

Can any body help me with code to consume SAP PI webservice using standalone Java client using WSDL and URL.

Accepted Solutions (0)

Answers (2)

Answers (2)

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I know it is a bit general guide, but hopefully you'll find it useful:

http://help.sap.com/saphelp_nwce72/helpdata/en/46/935a636110581de10000000a1553f7/frameset.htm

Regards,

Ervin

Former Member
0 Kudos
Former Member
0 Kudos

Hi Saurabh,

Thanks ofr your response.

However I am looking for standalone Java client code to consume this webservice.

Can any body help.

former_member182372
Active Contributor
0 Kudos

In NWDS select "New->Other->Web Services->Standalone Proxy Project", give a name for a project. Select new project, right click, select "New->Clinet Proxy Definition", specify your WS properties. Create a c class with "main" method like:


public static void main(String[] args) throws Exception
{
//ShipmentAlert is the name of proxy in this case. replace it with the name you have

		ShipmentAlert service = new ShipmentAlertImpl();
		ShipmentAlertViDocument port = (ShipmentAlertViDocument) service.getLogicalPort();
		
		port._setProperty("socketTimeout", "300000");
		ShipmentAlertDO[] ShipmentAlertDOs = port.getAlertDOs();
...
}

Former Member
0 Kudos

Hi Makshim,

In NWDS I was not able to find "Standalone Proxy Project" ,the available options are webservice,webservice client,WSDL.

Group,

I was using using the below code



import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class TestClient {  
public static void main(String [] args)  

 {  
     try{  
        String endpoint = "http://xxx:xxxx/dir/wsdl?p=1_fc5aa67c9f923ff090941f6f93fc08f1_portTypeBindingService";  
        Service service = new Service();  
        Call call = (Call)service.createCall(); 
        call.setUsername("XXXXX");
        call.setPassword("XXXXX");
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );  
        call.setOperationName("SI_q1");    
        call.setOperationName( new QName("http://itest.com/jmswebservice", "SI_q1") ); 
        String ret = (String) call.invoke( new Object[] {"adasd"});
        System.out.print(ret);
         }  
      catch(Exception e){  
             System.err.println(e.toString());  
        }  

  }  

  }


when I am executing I am getting the below error:

org.xml.sax.SAXException: Bad envelope tag: definitions

Can any body help.

Edited by: SATLPHO on Aug 4, 2011 10:41 AM