Soap Client For Mac

Soap Client For Mac 5,4/10 5327 votes

Soap client free download - SOAP Client, SOAP Toolkit, Soap, and many more programs. Enter to Search. My Profile Logout. CNET News Best Apps. Quickly and easily send REST, SOAP, and GraphQL requests directly within Postman. SOAP, or plain HTTP—and easily inspect even the largest responses. Postman also has built-in support for popular data formats such as OpenAPI GraphQL, and RAML.

The following sections provide information about creating and using SOAP message handlers:

Overview of SOAP Message Handlers

Web Services and their clients may need to access the SOAP message for additional processing of the message request or response. You can create SOAP message handlers to enable Web Services and clients to perform this additional processing on the SOAP message. A SOAP message handler provides a mechanism for intercepting the SOAP message in both the request and response of the Web Service.

A simple example of using handlers is to access information in the header part of the SOAP message. You can use the SOAP header to store Web Service specific information and then use handlers to manipulate it.

You can also use SOAP message handlers to improve the performance of your Web Service. After your Web Service has been deployed for a while, you might discover that many consumers invoke it with the same parameters. You could improve the performance of your Web Service by caching the results of popular invokes of the Web Service (assuming the results are static) and immediately returning these results when appropriate, without ever invoking the back-end components that implement the Web Service. You implement this performance improvement by using handlers to check the request SOAP message to see if it contains the popular parameters.

JAX-WS supports two types of SOAP message handlers: SOAP handlers and logical handlers. SOAP handlers can access the entire SOAP message, including the message headers and body. Logical handlers can access the payload of the message only, and cannot change any protocol-specific information (like headers) in a message.

Adding Server-side SOAP Message Handlers: Main Steps

The following procedure describes the high-level steps to add SOAP message handlers to your Web Service.

It is assumed that you have created a basic JWS file that implements a Web Service and that you want to update the Web Service by adding SOAP message handlers and handler chains. It is also assumed that you have set up an Ant-based development environment and that you have a working build.xml file that includes a target for running the jwsc Ant task. For more information, see in Getting Started With WebLogic Web Services Using JAX-WS:

  • Use Cases and Examples
  • Developing WebLogic Web Services
  • Programming the JWS File
  • Invoking Web Services
  • Table 8-1 Steps to Add SOAP Message Handlers to a Web Service
    Step
    1
    Design SOAP message handlers and group them together in a handler chain. See Designing the SOAP Message Handlers and Handler Chains.
    For each handler in the handler chain, create a Java class that implements the SOAP message handler interface.
    3
    Update your JWS file, adding annotations to configure the SOAP message handlers.
    4
    See Creating the Handler Chain Configuration File.
    Compile all handler classes in the handler chain and rebuild your Web Service.

Adding Client-side SOAP Message Handlers: Main Steps

You can configure client-side SOAP message handlers for both stand-alone clients and clients that run inside of WebLogic Server. You create the actual Java client-side handler in the same way you create a server-side handler—by creating a Java class that implements the SOAP message handler interface. In many cases you can use the exact same handler class on both the Web Service running on WebLogic Server and the client applications that invoke the Web Service. For example, you can write a generic logging handler class that logs all sent and received SOAP messages, both for the server and for the client.

The following procedure describes the high-level steps to add client-side SOAP message handlers to the client application that invokes a Web Service operation.

It is assumed that you have created the client application that invokes a deployed Web Service, and that you want to update the client application by adding client-side SOAP message handlers and handler chains. It is also assumed that you have set up an Ant-based development environment and that you have a working build.xml file that includes a target for running the clientgen Ant task. For more information, see “Invoking a Web Service from a Stand-alone Client: Main Steps” in Getting Started With WebLogic Web Services Using JAX-WS.

Table 8-2 Steps to Use Client-side SOAP Message Handlers
Step
1
This step is similar to designing the server-side SOAP message handlers, except the perspective is from the client application, rather than a Web Service. See Designing the SOAP Message Handlers and Handler Chains.
For each handler in the handler chain, create a Java class that implements the SOAP message handler interface.
This step is similar to designing the server-side SOAP message handlers, except the perspective is from the client application, rather than a Web Service. See Creating the SOAP Message Handler for details about programming a handler class.
Update your client to programmatically configure the SOAP message handlers.
See Configuring the Client-side SOAP Message Handlers.
Update the build.xml file that builds your application, specifying to the clientgen Ant task the customization file.
5
Rebuild your client application by running the relevant task.

When you next run the client application, the SOAP messaging handlers listed in the configuration file automatically execute before the SOAP request message is sent and after the response is received.

Note:You do not have to update your actual client application to invoke the client-side SOAP message handlers; as long as you specify to the clientgen Ant task the handler configuration file, the generated interface automatically takes care of executing the handlers in the correct sequence.

Designing the SOAP Message Handlers and Handler Chains

When designing your SOAP message handlers, you must decide:

  • The number of handlers needed to perform the work.
  • The sequence of execution.

You group SOAP message handlers together in a handler chain. Each handler in a handler chain may define methods for both inbound and outbound messages.

Typically, each SOAP message handler defines a separate set of steps to process the request and response SOAP message because the same type of processing typically must happen for the inbound and outbound message. You can, however, design a handler that processes only the SOAP request and does no equivalent processing of the response. You can also choose not to invoke the next handler in the handler chain and send an immediate response to the client application at any point.

Server-side Handler Execution

When invoking a Web Service, WebLogic Server executes handlers as follows:

  1. The inbound methods for handlers in the handler chain are all executed in the order specified by the JWS annotation. Any of these inbound methods might change the SOAP message request.
  2. When the last handler in the handler chain executes, WebLogic Server invokes the back-end component that implements the Web Service, passing it the final SOAP message request.
  3. When the back-end component has finished executing, the outbound methods of the handlers in the handler chain are executed in the reverse order specified by the JWS annotation. Any of these outbound methods might change the SOAP message response.
  4. When the first handler in the handler chain executes, WebLogic Server returns the final SOAP message response to the client application that invoked the Web Service.

For example, assume that you are going to use the @HandlerChain JWS annotation in your JWS file to specify an external configuration file, and the configuration file defines a handler chain called SimpleChain that contains three handlers, as shown in the following sample:

The following graphic shows the order in which WebLogic Server executes the inbound and outbound methods of each handler.

Download SheepShaver Precompiled binaries. For announcements of prebuilt binaries for Linux, Mac OS X, and Windows, head over to the E-Maculation Forums. Getting the source code. The source code of SheepShaver (and Basilisk II) is being hosted in a Git repository on GitHub: Main page of the GitHub repository. SheepShaver is an open source emulator of PowerPC based Macintosh computers. Using SheepShaver it is possible to emulate a Macintosh computer capable of running Mac OS 7.5.2 through 9.0.4. Sheepshaver mojave.

Figure 8-1 Order of Execution of Handler Methods

Client-side Handler Execution

In the case of a client-side handler, the handler executes twice:

  • Directly before the client application sends the SOAP request to the Web Service
  • Directly after the client application receives the SOAP response from the Web Service

Creating the SOAP Message Handler

There are two types of SOAP message handlers that you can create, as defined in the following table.

Table 8-3 Types of SOAP Message Handlers
Description
Enables you to access the full SOAP message including headers. SOAP handlers are defined using the javax.xml.ws.handler.soap.SOAPHandler interface. They are invoked using the import javax.xml.ws.handler.soap.SOAPMessageContext which extends javax.xml.ws.handler.MessageContext. The SOAPMessageContext.getMessage() method returns a javax.xml.soap.SOAPMessage.
Provides access to the payload of the message. Logical handlers cannot change any protocol-specific information (like headers) in a message. Logical handlers are defined using the javax.xml.ws.handler.LogicalHandler interface. They are invoked using the javax.xml.ws.handler.LogicalMessageContext which extends javax.xml.ws.handler.MessageContext. The LogicalMessageContext.getMessage() method returns a javax.xml.ws.LogicalMessage.
The payload can be accessed either as a JAXB object or as a javax.xml.transform.Source object.

Each type of message handler extends the javax.xml.ws.Handler interface which defines the methods defined in the following table.

Table 8-4 Handler Interface Methods
Description
Manages normal processing of inbound and outbound messages. A property in the MessageContext object is used to determine if the message is inbound or outbound. See Implementing the Handler.handleMessage() Method.
Manages fault processing of inbound and outbound messages. See Implementing the Handler.handleFault() Method.
Concludes the message exchange and cleans up resources that were accessed during processing. See Implementing the Handler.close() Method.

In addition, you can use the @javax.annotation.PostConstruct and @javax.annotation.PreDestroy annotations to identify methods that must be executed after the handler is created and before the handler is destroyed, respectively.

Sometimes you might need to directly view or update the SOAP message from within your handler, in particular when handling attachments, such as image. In this case, use the javax.xml.soap.SOAPMessage abstract class, which is part of the SOAP With Attachments API for Java 1.1 (SAAJ) specification For details, see Directly Manipulating the SOAP Request and Response Message Using SAAJ.

Example of a SOAP Handler

The following example illustrates a simple SOAP handler that returns whether the message is inbound or outbound along with the message content.

Example of a Logical Handler

The following example illustrates a simple logical handler that returns whether the message is inbound or outbound along with the message content.

Implementing the Handler.handleMessage() Method

The Handler.handleMessage() method is called to intercept a SOAP message request before and after it is processed by the back-end component. Its signature is:

Implement this method to perform such tasks as encrypting/decrypting data in the SOAP message before or after it is processed by the back-end component, and so on.

C extends javax.xml.ws.handler.MessageContext. The MessageContext properties allow the handlers in a handler chain to determine if a message is inbound or outbound and to share processing state. Use the SOAPMessageContext or LogicalMessageContext sub-interface of MessageContext to get or set the contents of the SOAP or logical message, respectively. For more information, see Using the Message Context Property Values and Methods.

After you code all the processing of the SOAP message, code one of the following scenarios:

  • Invoke the next handler on the handler request chain by returning true.
  • The next handler on the request chain is specified as the next <handler> subelement of the <handler-chain> element in the configuration file specified by the @HandlerChain annotation.

  • Block processing of the handler request chain by returning false.
  • Blocking the handler request chain processing implies that the back-end component does not get executed for this invoke of the Web Service. You might want to do this if you have cached the results of certain invokes of the Web Service, and the current invoke is on the list.

    Although the handler request chain does not continue processing, WebLogic Server does invoke the handler response chain, starting at the current handler.

  • Throw the java.lang.RuntimeException or java.xml.ws.ProtocolException for any handler-specific runtime errors.
  • WebLogic Server catches the exception, terminates further processing of the handler request chain, logs the exception to the WebLogic Server log file, and invokes the handleFault() method of this handler.

Implementing the Handler.handleFault() Method

The Handler.handleFault() method processes the SOAP faults based on the SOAP message processing model. Its signature is:

Implement this method to handle processing of any SOAP faults generated by the handleMessage() method, as well as faults generated by the back-end component.

C extends javax.xml.ws.handler.MessageContext. The MessageContext properties allow the handlers in a handler chain to determine if a message is inbound or outbound and to share processing state.Use the LogicalMessageContext or SOAPMessageContext sub-interface of MessageContext to get or set the contents of the logical or SOAP message, respectively. For more information, see Using the Message Context Property Values and Methods.

After you code all the processing of the SOAP fault, do one of the following:

  • Invoke the handleFault() method on the next handler in the handler chain by returning true.
  • Block processing of the handler fault chain by returning false.

Implementing the Handler.close() Method

The Handler.close() method concludes the message exchange and cleans up resources that were accessed during processing. Its signature is:

Using the Message Context Property Values and Methods

The following context objects are passed to the SOAP message handlers.

Table 8-5 Message Context Property Values
Description
Context object for logical handlers.
Context object for SOAP handlers.

Each context object extends javax.xml.ws.handler.MessageContext which enables you to access a set of runtime properties of a SOAP message handler from the client application or Web Service, or directly from the javax.xml.ws.WebServiceContext from a Web Service.

For example, the MessageContext.MESSAGE_OUTBOUND_PROPERTY holds a Boolean value that is used to determine the direction of a message. During a request, you can check the value of this property to determine if the message is an inbound or outbound request. The property would be true when accessed by a client-side handler or false when accessed by a server-side handler.

For more information about the MessageContext property values that are available, see “Using the MessageContext Property Values” in Getting Started With WebLogic Web Services Using JAX-WS.

The LogicalMessageContext class defines the following method for processing the Logical message. For more information, see the java.xml.ws.handler.LogicalMessageContext Javadoc.

Table 8-6 LogicalMessageContext Class Method
Description
Gets a javax.xml.ws.LogicalMessage object that contains the SOAP message.

The SOAPMessageContext class defines the following methods for processing the SOAP message. For more information, see the java.xml.ws.handler.soap.SOAPMessageContext Javadoc.

Note:The SOAP message itself is stored in a javax.xml.soap.SOAPMessage object. For detailed information on this object, see Directly Manipulating the SOAP Request and Response Message Using SAAJ.
Table 8-7 SOAPMessageContext Class Methods
Description
Gets headers that have a particular qualified name from the message in the message context.
Gets a javax.xml.soap.SOAPMessage object that contains the SOAP message.
Gets the SOAP actor roles associated with an execution of the handler chain.
Sets the SOAP message.

Directly Manipulating the SOAP Request and Response Message Using SAAJ

The javax.xml.soap.SOAPMessage abstract class is part of the SOAP With Attachments API for Java 1.1 (SAAJ) specification. You use the class to manipulate request and response SOAP messages when creating SOAP message handlers. This section describes the basic structure of a SOAPMessage object and some of the methods you can use to view and update a SOAP message.

A SOAPMessage object consists of a SOAPPart object (which contains the actual SOAP XML document) and zero or more attachments.

Refer to the SAAJ Javadocs for the full description of the SOAPMessage class.

The SOAPPart Object

The SOAPPart object contains the XML SOAP document inside of a SOAPEnvelope object. You use this object to get the actual SOAP headers and body.

The following sample Java code shows how to retrieve the SOAP message from a MessageContext object, provided by the Handler class, and get at its parts:

The AttachmentPart Object

The javax.xml.soap.AttachmentPart object contains the optional attachments to the SOAP message. Unlike the rest of a SOAP message, an attachment is not required to be in XML format and can therefore be anything from simple text to an image file.

Note:If you are going to access a java.awt.Image attachment from your SOAP message handler, see Manipulating Image Attachments in a SOAP Message Handler for important information.

Use the following methods of the SOAPMessage class to manipulate the attachments. For more information, see the javax.xml.soap.SOAPMessage Javadoc.

Table 8-8 SOAPMessage Class Methods to Manipulate Attachments
Description
Adds an AttachmentPart object, after it has been created, to the SOAPMessage.
Returns the number of attachments in this SOAP message.
Create an AttachmentPart object from another type of Object.
Gets all the attachments (as AttachmentPart objects) into an Iterator object.

Manipulating Image Attachments in a SOAP Message Handler

It is assumed in this section that you are creating a SOAP message handler that accesses a java.awt.Image attachment and that the Image has been sent from a client application that uses the client JAX-RPC stubs generated by the clientgen Ant task.

In the client code generated by the clientgen Ant task, a java.awt.Image attachment is sent to the invoked WebLogic Web Service with a MIME type of text/xml rather than image/gif, and the image is serialized into a stream of integers that represents the image. In particular, the client code serializes the image using the following format:

This means that, in your SOAP message handler that manipulates the received Image attachment, you must deserialize this stream of data to then re-create the original image.

Configuring Handler Chains in the JWS File

The @javax.jws.HandlerChain annotation (also called @HandlerChain in this chapter for simplicity) enables you to configure a handler chain for a Web Service. Use the file attribute to specify an external file that contains the configuration of the handler chain you want to associate with the Web Service. The configuration includes the list of handlers in the chain, the order in which they execute, the initialization parameters, and so on.

The following JWS file shows an example of using the @HandlerChain annotation; the relevant Java code is shown in bold:

Before you use the @HandlerChain annotation, you must import it into your JWS file, as shown above.

Use the file attribute of the @HandlerChain annotation to specify the name of the external file that contains configuration information for the handler chain. The value of this attribute is a URL, which may be relative or absolute. Relative URLs are relative to the location of the JWS file at the time you run the jwsc Ant task to compile the file.

Note:It is an error to specify more than one @HandlerChain annotation in a single JWS file.

For details about creating the external configuration file, see Creating the Handler Chain Configuration File.

For additional detailed information about the standard JWS annotations discussed in this section, see the Web Services Metadata for the Java Platform specification.

Creating the Handler Chain Configuration File

As described in the previous section, you use the @HandlerChain annotation in your JWS file to associate a handler chain with a Web Service. You must create the handler chain file that consists of an external configuration file that specifies the list of handlers in the handler chain, the order in which they execute, the initialization parameters, and so on.

Because this file is external to the JWS file, you can configure multiple Web Services to use this single configuration file to standardize the handler configuration file for all Web Services in your enterprise. Additionally, you can change the configuration of the handler chains without needing to recompile all your Web Services.

The configuration file uses XML to list one or more handler chains, as shown in the following simple example:

In the example, the handler chain contains two handlers implemented with the class names specified with the <handler-class> element. The two handlers execute in forward order before the relevant Web Service operation executes, and in reverse order after the operation executes.

Use the <init-param> and <soap-role>child elements of the <handler> element to specify the handler initialization parameters and SOAP roles implemented by the handler, respectively.

You can include logical and SOAP handlers in the same handler chain. At runtime, the handler chain is re-ordered so that all logical handlers are executed before SOAP handlers for an outbound message, and vice versa for an inbound message.

For the XML Schema that defines the external configuration file, additional information about creating it, and additional examples, see the Web Services Metadata for the Java Platform specification.

Compiling and Rebuilding the Web Service

It is assumed in this section that you have a working build.xml Ant file that compiles and builds your Web Service, and you want to update the build file to include handler chain. See “Developing WebLogic Web Services” in Getting Started With WebLogic Web Services Using JAX-WS for information on creating this build.xml file.

Follow these guidelines to update your development environment to include message handler compilation and building:

  • After you have updated the JWS file with the @HandlerChain annotation, you must rerun the jwsc Ant task to recompile the JWS file and generate a new Web Service. This is true anytime you make a change to an annotation in the JWS file.
  • If you used the @HandlerChain annotation in your JWS file, reran the jwsc Ant task to regenerate the Web Service, and subsequently changed only the external configuration file, you do not need to rerun jwsc for the second change to take affect.

  • The jwsc Ant task compiles SOAP message handler Java files into handler classes (and then packages them into the generated application) if all the following conditions are true:
    • The handler classes are referenced in the @HandlerChain annotation of the JWS file.
    • The Java files are located in the directory specified by the sourcepath attribute.
    • The classes are not currently in your CLASSPATH.
    • If you want to compile the handler classes yourself, rather than let jwsc compile them automatically, ensure that the compiled classes are in your CLASSPATH before you run the jwsc Ant task.

  • You deploy and invoke a Web Service that has a handler chain associated with it in the same way you deploy and invoke one that has no handler chain. The only difference is that when you invoke any operation of the Web Service, the WebLogic Web Services runtime executes the handlers in the handler chain both before and after the operation invoke.

Configuring the Client-side SOAP Message Handlers

You configure client-side SOAP message handlers in one of the following ways:

  • Set a handler chain directly on the javax.xml.ws.BindingProvider, such as a port proxy or javax.xml.ws.Dispatch object. For example:
  • Implement a javax.xml.ws.handler.HandlerResolver on a Service instance. For example:
  • Add a handler resolver to the Service instance using the setHandlerResolver() method. In this case, the port proxy or Dispatch object created from the Service instance uses the HandlerResolver to determine the handler chain. For example:

  • Create a customization file that includes a <binding> element that contains a handler chain description. The schema for the <handler-chains> element is the same for both handler chain files (on the server) and customization files. For example:
  • Use the <binding> child element of the clientgen command to pass the customization file.


© BEA Systems