cancel
Showing results for 
Search instead for 
Did you mean: 

Invoking webservice-Authentication issue

Former Member
0 Kudos

Hi All,

I need a help to solve the given below issue.

Scenario is to use the Webservice concept for the integration between non SAP system ( webservice) with the non SAP System( webservice) via PI using SOAP Adapter.

I have generated the WSDL file from PI and given it to the Source System.When I tried testing with the SOAP Client (Altova XML Spy) to PI , the establishment of connection is fine for HTTP (the userID and Password is given in the prompt window of XMLSpy tool).Getting the message as "Webservice has sent an empty response".

But the problem occur when the Java Client tries to invoke the webservice from their desktop(within the network).

Error message from Java client while connecting is given below( pasted few lines):

org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme

INFO: basic authentication scheme selected

Jan 15, 2008 9:56:13 AM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge

INFO: No credentials available for BASIC 'XISOAPApps'@192.85.27.136:50800

Jan 15, 2008 9:56:13 AM org.codehaus.xfire.transport.http.HttpChannel sendViaClient

I also tried giving the user ID and Password in the URL of SOAP Address .But still it did not work out.I have gone through so many blogs ( How to remove the authentication in sender SOAP Adapter).But that option is not accepted as we are changing the SAP Standard code.

I would like to know whether the user/password authentication is to be done in the visual administrator in PI or Java webclient should write any code from their side for authentication ( user Id/Password).

If the code is to be written in Java ,Can you give me the piece of code written for authentication.

Right now I am only testing the interface between the Source and the PI System.

Please provide your assistance.

Regards

B.Dheepa

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

The Java Cient has to provide the user name and password.

You can use the folowing snippet

connection = url.openConnection();

if( connection instanceof HttpURLConnection )

((HttpURLConnection)connection).setRequestMethod("POST");

connection.setRequestProperty("Content-Type","text/xml");

connection.setDoOutput(true);

String password = User + ":" + Password ;

String encodedPassword = new String(new BASE64Encoder().encode(password.getBytes()));

connection.setRequestProperty ("Authorization", "Basic " + encodedPassword);

connection.connect();

Please award points if you find the message useful

Edited by: Kanwaljit Singh on Jan 22, 2008 11:03 PM

Former Member
0 Kudos

Hi ,

The issue has been solved where we need to write a piece of code for authentication in the Serviceclient.java file.

public XXXXServiceClient() {

create0();

service0.setProperty(Channel.USERNAME, "username");

service0.setPropertyChannel.PASSWORD, "password");

Regards

B.Dheepa