|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.xml.soap.SOAPConnection
net.sourceforge.spnego.SpnegoSOAPConnection
public class SpnegoSOAPConnection
This class can be used to make SOAP calls to a protected SOAP Web Service.
The idea for this class is to replace code that looks like this...
final SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); conn = soapConnectionFactory.createConnection();
with code that looks like this...
conn = new SpnegoSOAPConnection("spnego-client", "dfelix", "myp@s5");
Example:
SOAPMessage response = null; final SpnegoSOAPConnection conn = new SpnegoSOAPConnection(this.module, this.kuser, this.kpass); try { final MessageFactory msgFactory = MessageFactory.newInstance(); final SOAPMessage message = msgFactory.createMessage(); final SOAPBody body = message.getSOAPBody(); final SOAPBodyElement bodyElement = body.addBodyElement( new QName(this.namespace, this.methodName, this.nsprefix)); for (int i=0; i<args.length; i++) { final SOAPElement element = bodyElement.addChildElement( new QName("arg" + i)); element.addTextNode(args[i]); } response = conn.call(message, this.serviceLocation); } finally { conn.close(); }
To see a full working example, take a look at the ExampleSpnegoSOAPClient.java example.
Also, take a look at the how to connect to a protected SOAP Web Service example.
SpnegoHttpURLConnection
Field Summary | |
---|---|
private SpnegoHttpURLConnection |
conn
|
Constructor Summary | |
---|---|
SpnegoSOAPConnection(GSSCredential creds)
Create an instance where the GSSCredential is specified by the parameter and where the GSSCredential is automatically disposed after use. |
|
SpnegoSOAPConnection(GSSCredential creds,
boolean dispose)
Create an instance where the GSSCredential is specified by the parameter and whether the GSSCredential should be disposed after use. |
|
SpnegoSOAPConnection(String loginModuleName)
Creates an instance where the LoginContext relies on a keytab file being specified by "java.security.auth.login.config" or where LoginContext relies on tgtsessionkey. |
|
SpnegoSOAPConnection(String loginModuleName,
String username,
String password)
Creates an instance where the LoginContext does not require a keytab file. |
Method Summary | |
---|---|
SOAPMessage |
call(SOAPMessage request,
Object endpoint)
|
void |
close()
|
Methods inherited from class javax.xml.soap.SOAPConnection |
---|
get |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final transient SpnegoHttpURLConnection conn
Constructor Detail |
---|
public SpnegoSOAPConnection(String loginModuleName) throws LoginException
loginModuleName
-
LoginException
public SpnegoSOAPConnection(GSSCredential creds)
creds
- credentials to usepublic SpnegoSOAPConnection(GSSCredential creds, boolean dispose)
creds
- credentials to usedispose
- true if GSSCredential should be diposed after usepublic SpnegoSOAPConnection(String loginModuleName, String username, String password) throws LoginException
loginModuleName
- username
- password
-
LoginException
Method Detail |
---|
public final SOAPMessage call(SOAPMessage request, Object endpoint) throws SOAPException
call
in class SOAPConnection
SOAPException
public final void close()
close
in class SOAPConnection
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |