Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.muse.ws.addressing.soap
Class SimpleSoapClient

    java.lang.Object
      org.apache.muse.ws.addressing.soap.SimpleSoapClient

All Implemented Interfaces:
  SoapClient, SoapMonitor

public class SimpleSoapClient
extends java.lang.Object
implements SoapClient

SimpleSoapClient is and implementation of SoapClient that relies on the java.net.HttpURLConnection API to send and receive SOAP messages. It provides complete WS-Addressing (WS-A) support, so that all requests are routed with WS-A EPRs and Actions. Messages are sent with valid reply and fault EPRs so that responses can be redirected if desired.

Author:
  Dan Jemiolo (danj)

Constructor Summary
`SimpleSoapClient()`

Method Summary
`protected org.w3c.dom.Element` | `createMessage(EndpointReference source, EndpointReference destination, java.lang.String action, org.w3c.dom.Element[] bodyElements, org.w3c.dom.Element[] extraHeaders)` Creates a valid SOAP message, including WS-A headers that specify the destination and operation (action).
`protected java.net.URL` | `getDestinationURL(EndpointReference destination)`
`int` | `getSoapMonitorPort()`
`java.io.PrintWriter` | `getTraceWriter()`
`boolean` | `isUsingSoapMonitor()` The default value is 'false'.
`boolean` | `isUsingTrace()` {@inheritDoc} The default value is 'false'.
`org.w3c.dom.Element[]` | `send(EndpointReference src, EndpointReference dest, java.lang.String wsaAction, org.w3c.dom.Element[] body)` Sends a SOAP envelope with the given body to the given destination.
`org.w3c.dom.Element[]` | `send(EndpointReference src, EndpointReference dest, java.lang.String wsaAction, org.w3c.dom.Element[] body, org.w3c.dom.Element[] extraHeaders)` Sends a SOAP envelope with the given body to the given destination.
`void` | `setTrace(boolean trace)`
`void` | `setTraceWriter(java.io.PrintWriter writer)` {@inheritDoc} Note that there is a default PrintWriter set at instantiation - it wraps the System.out stream.
`void` | `startSoapMonitor(int monitorPort)` Causes the SoapClient to send messages to the given port.
`void` | `stopSoapMonitor()` If SOAP monitoring was in use, the client will revert back to sending the messages to the port in the EPR's wsa:Address.
`protected void` | `trace(org.w3c.dom.Element xml, boolean incoming)`
`protected void` | `trace(java.lang.String message)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleSoapClient

    public SimpleSoapClient()

Method Detail

### createMessage

    protected org.w3c.dom.Element createMessage(EndpointReference source,
                                                EndpointReference destination,
                                                java.lang.String action,
                                                org.w3c.dom.Element[] bodyElements,
                                                org.w3c.dom.Element[] extraHeaders)

  Creates a valid SOAP message, including WS-A headers that specify the destination and operation (action). The WS-A headers include proper return/fault information for the recipient to use in response. The 'extra headers' are SOAP header elements that do not belong to the WS-A namespace.

  Parameters:
    `source` -
    `destination` -
    `action` -
    `bodyElements` -
    `extraHeaders` -
  Returns:
    A valid SOAP message that can be sent to the destination.

### getDestinationURL

    protected java.net.URL getDestinationURL(EndpointReference destination)

  Parameters:
    `destination` -
  Returns:
    The URL of the EPR's wsa:Address. If SOAP monitoring is on, the URL's port is switched to the monitor port.

### getSoapMonitorPort

    public int getSoapMonitorPort()

  Specified by:
    `getSoapMonitorPort` in interface `SoapMonitor`
  Returns:
    The port to which messages are being sent when TCP/SOAP monitoring is being used. When no monitoring is used (normal mode), this returns -1.

### getTraceWriter

    public java.io.PrintWriter getTraceWriter()

### isUsingSoapMonitor

    public boolean isUsingSoapMonitor()

  The default value is 'false'.

  Specified by:
    `isUsingSoapMonitor` in interface `SoapMonitor`
  Returns:
    True if messages are being redirected to a SOAP monitor port.

### isUsingTrace

    public boolean isUsingTrace()

  {@inheritDoc}
  The default value is 'false'.

### send

    public org.w3c.dom.Element[] send(EndpointReference src,
                                      EndpointReference dest,
                                      java.lang.String wsaAction,
                                      org.w3c.dom.Element[] body)

  Description copied from interface: `SoapClient`
  Sends a SOAP envelope with the given body to the given destination. The SOAP header will include WS-A headers, one of which will be the WS-A Action specified in the third parameter. This method is not asynchronous - it will wait for a response and return the contents of the SOAP body.

  Specified by:
    `send` in interface `SoapClient`
  Parameters:
    `src` - The EPR of the service sending the message.
    `dest` - The EPR of the service that will receive the message.
    `wsaAction` - The WS-A Action that specifies the operation to be invoked on the destination service.
    `body` - The contents of the SOAP body.
  Returns:
    The contents of the SOAP body in the response message. If the request resulted in a fault, the contents will include the fault XML. Note that such faults are not related to basic networking/SOAP faults.

### send

    public org.w3c.dom.Element[] send(EndpointReference src,
                                      EndpointReference dest,
                                      java.lang.String wsaAction,
                                      org.w3c.dom.Element[] body,
                                      org.w3c.dom.Element[] extraHeaders)

  Description copied from interface: `SoapClient`
  Sends a SOAP envelope with the given body to the given destination. The SOAP header will include WS-A headers, one of which will be the WS-A Action specified in the third parameter. This method is not asynchronous - it will wait for a response and return the contents of the SOAP body.

  Specified by:
    `send` in interface `SoapClient`
  Parameters:
    `src` - The EPR of the service sending the message.
    `dest` - The EPR of the service that will receive the message.
    `wsaAction` - The WS-A Action that specifies the operation to be invoked on the destination service.
    `body` - The contents of the SOAP body.
    `extraHeaders` - SOAP header elements that should be added to the outgoing message. These headers must not use the WS-Addressing namespace.
  Returns:
    The contents of the SOAP body in the response message. If the request resulted in a fault, the contents will include the fault XML. Note that such faults are not related to basic networking/SOAP faults.

### setTrace

    public void setTrace(boolean trace)

### setTraceWriter

    public void setTraceWriter(java.io.PrintWriter writer)

  {@inheritDoc}
  Note that there is a default PrintWriter set at instantiation - it wraps the System.out stream.

### startSoapMonitor

    public void startSoapMonitor(int monitorPort)

  Description copied from interface: `SoapMonitor`
  Causes the SoapClient to send messages to the given port. This does not change the port number in the WS-A EPR found in the SOAP headers. The receiver will have no idea it is taking part in SOAP monitoring. Only the original HTTP GET will have a different port.

  Specified by:
    `startSoapMonitor` in interface `SoapMonitor`
  Parameters:
    `monitorPort` - A positive integer - 0 to 65535.

### stopSoapMonitor

    public void stopSoapMonitor()

  Description copied from interface: `SoapMonitor`
  If SOAP monitoring was in use, the client will revert back to sending the messages to the port in the EPR's wsa:Address. If SOAP monitoring was not in use, the call is a no-op.

  Specified by:
    `stopSoapMonitor` in interface `SoapMonitor`

### trace

    protected void trace(org.w3c.dom.Element xml,
                         boolean incoming)

  Parameters:
    `xml` - An XML fragment that will be sent to the trace log.
    `incoming` - True if the message was part of an incoming SOAP message. This merely provides some context in the trace log.

### trace

    protected void trace(java.lang.String message)

  Parameters:
    `message` - The message to print to the trace log.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD