on 08-04-2011 6:19 AM
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
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&version=3.0&Sender.Service=XXX&Interface=xxxamp;QualityOfService=ExactlyOnce&sap-client=xxx&sap-user=xxx&sap-password=xxx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The JAVA developers try use of USERNAME_PROPERTY and PASSWORD_PROPERTY
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.