cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problems calling SOAP in JAVA program

Former Member
0 Likes
3,465

Hello Experts,

I'm quite new to using SOAP. I just want to ask how to call SOAP in JAVA specifically NetBean. I already created a webservice using the WSDL a created in SAP XI but problem is when I'm trying to invoke the webservice I always get error "401 Unathorized". Is there a way to specify the user name and password when calling the webservice via JAVA code?

Error Message:

Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized

Sample Code:

public class Main {

/**

  • @param args the command line arguments

*/

public static void main(String[] args) throws UnsupportedEncodingException {

ph.co.amkor.atp.ppmodule.synch.ReqCustomerNoDT Req = new ph.co.amkor.atp.ppmodule.synch.ReqCustomerNoDT();

Req.setCompanyCode(" ");

Req.setCustomerNumber("00110");

RespCustDetailsDT cdwsMI = cdwsMI(Req);

System.out.println("Customer :" + cdwsMI.getCustomerNumber());

System.out.println("Name :" + cdwsMI.getName());

System.out.println("Street :" + cdwsMI.getStreet());

System.out.println("Coutnry :" + cdwsMI.getCountry());

System.out.println("City :" + cdwsMI.getCity());

System.out.println("MSG Type :" + cdwsMI.getMessageType());

System.out.println("Message :" + cdwsMI.getReturnMessage());

}

private static RespCustDetailsDT cdwsMI(ph.co.amkor.atp.ppmodule.synch.ReqCustomerNoDT reqCustomerNoMT) {

ph.co.amkor.atp.ppmodule.synch.CDWSMIService service = new ph.co.amkor.atp.ppmodule.synch.CDWSMIService();

ph.co.amkor.atp.ppmodule.synch.CDWSMI port = service.getCDWSMIPort();

return port.cdwsMI(reqCustomerNoMT);

}

}

SAP Netweaver Information

Session Information

Application:

Design: Integration Builder

User:

aafri

Logon Language:

Korean

Server:

atpxisd01_XD1_01

Server Node:

server0

Runtime Environment

Java version:

1.4.2_12

Java vendor:

Sun Microsystems Inc.

Version

Service pack:

12

Release:

NW04S_12_REL

Latest change:

29423

Sync time:

${sync.time}

Regards,

Alfred

View Entire Topic
Former Member
0 Likes

Hi,

You have to pass user name and password of PI in JAVA Program.

Regards,

Raj