Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

WebService-Java-Problem

Hello Experts,

I´am trying to connect my Java-Program with a webservice in SAP-System. I generated the Service by myself with a Functionblock, a simple one, just import four parameters form java into sap. The service works very fine. I tested it with SOAPUI (WSDL-URL: http://localhost:8000/sap/bc/srt/wsdl/bndg_DE1A24DE2892DFF1940C0013779CE381/wsdl11/allinone/ws_policy/document?sap-client=000).

After this I wanted to generate the classes for Java with wsimport. Here was the problem that wsimport couldn´t read all tags of the WSDL, for example UsingPolicy, and I have to edit the file by myself. At least it works and I got my classes. Now I want to import the four parameters but if I run the Application I´ve got this errormessage:

Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://localhost:8000/sap/bc/srt/wsdl/bndg_DE1A24DE2892DFF1940C0013779CE381/wsdl11/allinone/ws_policy/document?sap-client=000. It failed with:

Server returned HTTP response code: 401 for URL: http://localhost:8000/sap/bc/srt/wsdl/bndg_DE1A24DE2892DFF1940C0013779CE381/wsdl11/allinone/ws_policy/document?sap-client=000.

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:136)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:122)

at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:226)

at com.sun.xml.internal.ws.client.WSServiceDelegate.(Service.java:40)

at com.nh.sap_erp.DatenübertragungWebService.main(DatenübertragungWebService.java:13)

Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8000/sap/bc/srt/wsdl/bndg_DE1A24DE2892DFF1940C0013779CE381/wsdl11/allinone/ws_policy/document?sap-client=000

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1241)

at java.net.URL.openStream(URL.java:1009)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:785)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:236)

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:107)

... 7 more

I´ve checked so many tutorials but I couldn´t find a solution. So I hope, anyone of you can help me!

Thanks a lot!

Nicole

Former Member
Not what you were looking for? View more on this topic or Ask a question