cancel
Showing results for 
Search instead for 
Did you mean: 

PI webservice

former_member206760
Active Contributor
0 Kudos

Hi

We have created a PI webservice and provide the wsdl to a SOAP client.

Now they want to consume it and pass the PI credentials to it.

How can that SOAP client pass the PI credentials in their code ....is there a specific way or they can just add the credentials in the WSDL URL

Accepted Solutions (0)

Answers (3)

Answers (3)

Shabarish_Nair
Active Contributor
0 Kudos

tarang,

It depends.

Most of the tools let you use authentication to be embedded as part of the WS implementation.

But in some cases where such a flexibility si not there, you might want to pass the authentication as part of the URL itself.

The disadvantage of this is that the URL is exposed with the authentication details hence your user id should be created with this in consideration with minimum access.

ex.

http://<host>:<port>/sap/xi/engine?type=entry&amp;version=3.0&amp;Sender.Service=XXX&amp;Interface=xxxamp;QualityOfService=ExactlyOnce&sap-client=xxx&sap-user=xxx&sap-password=xxx

Former Member
0 Kudos

I agree with Shabarish.

As we written in a lot of 3D, authentication parameters can be inserted into Endpoint Url ( &sap-user=xxx&sap-password=yyy ), but this solution could expose to security problems.

Former Member
0 Kudos

Check this link:

http://developer.ebay.com/DevZone/xml/docs/HowTo/FirstCall/MakingCallJava.html

You can do something like this:

import java.io.ByteArrayOutputStream;
import java.net.URL;

import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;

		MessageFactory mf = MessageFactory.newInstance();
		SOAPMessage sm = mf.createMessage();
		SOAPEnvelope envelope = sm.getSOAPPart().getEnvelope();
		envelope.addNamespaceDeclaration("soap", "http://carmen.egr.msu.edu/service/soap/");
		envelope.setPrefix("soap");
		envelope.setAttribute("xmlns:soap", "http://carmen.egr.msu.edu/service/soap/");
		SOAPHeader header = envelope.getHeader();
		header.setPrefix("soap");
		SOAPElement context = header.addChildElement("context", "soap");
		context.setAttribute("xmlns", "urn:zimbraSoap");
		context.addChildElement("nonotify");
		context.addChildElement("noqualify");
		SOAPBody body = envelope.getBody();
		body.setPrefix("soap");
		SOAPElement authRequest = body.addChildElement("AuthRequest");
		authRequest.setPrefix("soap");
		authRequest.setAttribute("xmlns", "urn:zimbraSoap");
		SOAPElement account = authRequest.addChildElement("account");
		account.setAttribute("by", "name");
		account.setTextContent("user1");
		SOAPElement password = authRequest.addChildElement("password");
		password.setTextContent("foo");
		// Request
		SOAPElement request = body.addChildElement("SearchRequest");
		request.setAttribute("types", "appointment");
		request.setAttribute("calExpandInstStar", "1193004000000");
		request.setAttribute("calExpandInstEnd", "1256248799000");
		// Display SOAP Request
		System.out.println("\nSoap Request: ");
		writeSoapMessagePretty(sm);
		// Make request
		SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();
		SOAPConnection connection = sfc.createConnection();
		URL requestUrl = new URL("http://carmen.egr.msu.edu/service/soap/");
		SOAPMessage response = connection.call(sm, requestUrl);
		// Print SOAP response
		writeSoapMessagePretty(response);

former_member200962
Active Contributor
0 Kudos
How can that SOAP client pass the PI credentials in their code ....is there a specific way or they can just add the 
credentials in the WSDL URL

if the SOAP client is a proper tool then there should be some section to include the UID and PW....like we have for SAP SOAP Client......passing credentials in WSDL is not recommended when you are exchanging message with the application/ partner.

former_member206760
Active Contributor
0 Kudos

hi,

this is not a specific tool....they are going to write some java code to consume the PI webservice. is there a way they can pass the credentials in that code...

former_member200962
Active Contributor
0 Kudos

The JAVA developers try use of USERNAME_PROPERTY and PASSWORD_PROPERTY

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc...

former_member181985
Active Contributor
0 Kudos

it all depends on the Java SOAP API they are using. The java code developer should be knowing this. However, from PI end we have to inform that PI webservice supports BASIC AUTHENTICATION.