cancel
Showing results for 
Search instead for 
Did you mean: 

Invoke Valumapping WebService from Java Mapping

helmut_skolaut3
Active Participant
0 Kudos

Dear all,

I want to invoke a webservice out of a Java Mapping. At the moment, I am on the very beginning and have a small main method to start the mapping locally from NWDS.

I have generated a JAVA proxy like described in help.sap.com and implemented following code so far:

System.out.print("Output1\n");

try {

ValueMappingInService VMservice = new ValueMappingInService();

ValueMappingIn        VMport    = VMservice.getValueMappingInPort();

  

BindingProvider bp = (BindingProvider) VMport;

Map <String,Object> context = bp.getRequestContext();

context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"http://server:50000/ValueMappingInService/ValueMappingInImplBean");

context.put(BindingProvider.USERNAME_PROPERTY, "myUserID");

context.put(BindingProvider.PASSWORD_PROPERTY, "myPassword");

   

System.out.print("Output2\n"); 

ValueMappingQueryIn VMqueryIn = new ValueMappingQueryIn();

VMqueryIn.setGroupName("/B2BFP/GroupID");

      

System.out.print("Output3\n");

ValueMappingQueryOut VMqueryOut = VMport.query(VMqueryIn);

   

System.out.print("Output4\n");

System.out.print(VMqueryOut.getValueMappingID());

   

} catch (MalformedURLException e) {

// TODO Auto-generated catch block

  e.printStackTrace();

} catch (WebServiceException e) {

   e.printStackTrace();

}

Then I am running the Class locally in NWDS, and I get following output

Output1

Output2

Output3

javax.xml.ws.WebServiceException: Invalid Response code (401). Server [http://mucs0112.emea.amersports.int:50000/ValueMappingInService/ValueMappingInImplBean] returned message [Unauthorized]. Http proxy info:  none

at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.processTransportBindingCall(WSInvocationHandler.java:174)

at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEISyncMethod(WSInvocationHandler.java:121)

at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEIMethod(WSInvocationHandler.java:84)

at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invoke(WSInvocationHandler.java:65)

at $Proxy23.query(Unknown Source)

at edifactTpmMapper.EdifactTpmMapper.execute(EdifactTpmMapper.java:52)

at edifactTpmMapper.EdifactTpmMapper.main(EdifactTpmMapper.java:72)

Caused by: com.sap.engine.services.webservices.espbase.client.bindings.exceptions.TransportBindingException: Invalid Response code (401). Server [http://server:50000/ValueMappingInService/ValueMappingInImplBean] returned message [Unauthorized]. Http proxy info:  none

at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.handleSOAPResponseMessage(SOAPTransportBinding.java:588)

at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call_SOAP(SOAPTransportBinding.java:1369)

at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.callWOLogging(SOAPTransportBinding.java:990)

at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call(SOAPTransportBinding.java:944)

at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.processTransportBindingCall(WSInvocationHandler.java:168)

... 6 more

You see, the error must be with the "query" statement, as it has been after "Output3".

When I am removing the ENDPOINT_ADDRESS_PROPERTY, it will refer to the URL from porttype in the WSDL, but with same error message.

When I am using SOAP-UI the result is is fine for the web service

When I am adjusting the server URL with a wrong path, I am get instead a Response Code 404

I have double-checked 10 Times the user / password, not seeing anything odd.

SM20 is not showing any audit entry (PI Double-stack).

Any further idea I can check?

Regards

Helmut

Accepted Solutions (1)

Accepted Solutions (1)

helmut_skolaut3
Active Participant
0 Kudos

Hi all,

thanks for your help. But in regards of configuration their was no problem. I have found the root cause:

The password must not be case sensitive. After I have changed the password only having Uppercase Letters, special charcters and Digits, it worked.

Regards Helmut

Answers (2)

Answers (2)

former_member182412
Active Contributor
0 Kudos

Hi Helmut,

Check this blog, this is to call IntegratedConfiguration web service as part of directory API to double check the configuration and the sample code.

Regards,

Praveen

former_member186851
Active Contributor
0 Kudos

Helmut,

your UserID hase required role to create and view value mapping?