7 Configuring Web Service Bindings

This chapter describes how to configure Web Service bindings for SCA services and SCA references in Oracle WebLogic Server.

You can configure Web Service bindings in the <binding.ws> element in the Spring application context file for your application.

You can apply the Web Service binding to SCA services and SCA references as follows:

  • Parses the <binding.ws> element and, for service bindings, generates a WSDL of the service to be published.

  • For service bindings, publishes the "Plain Old Java Object" (POJO) as a Java API for XML-Based Web Services (JAX-WS) Web Service.

  • Accepts requests for the published services and performs reference invocations to the Web Services.

An example of a Web Service binding on a service is shown in the following example:

<sca:service name="SCAService" 
      type="com.oracle.test.SayHello" 
      target="hello">
   <wlsb:binding.ws" 
         name="mysvcname" 
         port="myportname" 
         uri="/mysvcnameuri"/>
</sca:service>

The following example represents a Web Service binding on a reference:

<sca:reference name="SCAReference" type="com.oracle.test.SayHelloRef">
  <wlsb:binding.ws" 
      location="http://localhost:7001/wlscaapp/myrefsvcnameuri" 
      port="http://test.oracle.com#wsdl.endpoint(SCAService2/myrefportname)"/>
</sca:reference>

For reference bindings that refer to services outside the current application, it is expected that the contract class used for the reference is generated from the WSDL using client tools such as the WebLogic clientgen Ant task or Oracle JDeveloper.

Caution:

If the contract class is not generated from JAX-WS compatible client tools, certain types of functionality may not work correctly.

The type that is specified in the type attribute of sca:reference must be a JAX-WS compatible interface, generated from the external WSDL using a JAX-WS compatible client generation tool such as the JAX-WS wsimport tool, the WebLogic clientgen Ant task, Oracle JDeveloper, or Oracle Enterprise Pack for Eclipse (OEPE).

binding.ws Element Attributes

Attributes of the <binding.ws> element are as follows:

databinding

Optional. Specifies the type of databinding to use for converting SOAP messages to and from Java. Valid values are:

location

Required for sca:reference bindings only. Specifies the location (that is, URL) where the external reference can be found. The WSDL must be made available by appending ?wsdl to this location.

name

Optional. Specifies the name of the binding.

For sca:service bindings, this name is published as the service name in the WSDL. It overrides the name specified in name attribute of the sca:service element.

port

Optional for sca:service bindings. Specifies the port name to use for the service endpoint.

Required for sca:reference bindings. Specifies the WSDL port that this reference points to in the external Web Service.

This should be of the form namespace uri#wsdl.endpoint(servicename/portname).

soapversion

Optional. Specifies the SOAP version of the Web Service. Valid values are 1.1 and 1.2. Defaults to 1.1.

uri

Required for sca:service bindings only. Specifies the location, relative to the context-root of the SCA application, where the Web Service must be published for this SCA service.

binding.ws Subelements

The <binding.ws> element can have the following subelements:

PolicyReference Element

The <PolicyReference> subelement of <binding.ws> specifies a reference to the security policy to use. It has the following attributes:

uri

Specifies the location of the policy. Only built-in WebLogic Server security policies are supported in this release.

direction

Optional. Specifies whether the policy is inbound, outbound, or both. The default is both.

See Configuring Security for more information about using the PolicyReference element to configure security policies.

property Element

The <property> subelement of <binding.ws> has a name attribute that accepts the following property names:

  • weblogic.sca.binding.ws.sdoSchemaFile

    Specifies the location of the schema file for SDO bindings.

    See Configuring TopLink/EclipseLink SDO Databinding.

  • weblogic.sca.binding.ws.externalCustomizationFile

    Specifies an external databinding customizing XML file.

    See About Configuring Custom Databinding.

  • weblogic.sca.binding.ws.referenceWsdlCacheTimeoutMins

    Configures WSDL caching when invoking references. To enable caching and to specify the caching timeout period, specify a positive number to indicate the number of minutes. To disable WSDL caching, specify zero or a negative value. If this property is not set, caching is enabled with a default timeout of 60 (minutes).

Configuring Security

You need to use the <PolicyReference> element to configure security policies for Web Services bindings. See PolicyReference Element.

The following security mechanisms are supported:

  • Username token with message protection (WS-Security 1.1)

  • X509 certificate authentication with message protection (WS-Security 1.1)

  • Anonymous with message protection (WS-Security 1.1)

  • ID Propagation using SAML token (sender-vouches) with message protection (WS-Security 1.1)

  • Username token over SSL

  • SAML token (Sender Vouches) over SSL

Security Configuration Examples

The following is an example of a security configuration for an SCA service:

<sca:service 
      name="SCAServicePolicy" 
      type="com.oracle.test.SayHelloRefImpl" 
      target="hello2">
   <binding.ws 
         xmlns="http://xmlns.oracle.com/weblogic/weblogic-sca-binding" 
         name="mypolicysvcname"
         port="uri:myns#wsdl.endpoint(mypolicysvc/mypolicyport)" 
         uri="/mypolicyuri">
      <PolicyReference 
            xmlns="http://schemas.xmlsoap.org/ws/2004/09/policy"
            uri="policy:Wssp1.2-Https-UsernameToken-Plain.xml"
            direction="inbound" />
  </binding.ws>
</sca:service>

If you want to specify that a SCA service or reference uses an Oracle Web Services Manager (OWSM) security policy instead of a WebLogic security policy, you need to set the optional weblogic.sca.binding.ws.usingOwsmPolicies property to true.

See Using Oracle Web Services Manager Security Policies in Securing WebLogic Web Services for Oracle WebLogic Server .

Security Configuration for SCA Service and SCA Reference Using OWSM Policy

Example 7-1 Security Configuration for SCA Service Using an OWSM Policy

The following is an example of security configuration for SCA service using an OWSM policy:

<sca:service name="SCAServicePolicy" 
      type="com.oracle.test.SayHelloRefImpl" 
      target="hello2">
   <binding.ws xmlns="http://xmlns.oracle.com/weblogic/weblogic-sca-binding" 
         name="mypolicysvcname"
         port="uri:myns#wsdl.endpoint(mypolicysvc/mypolicyport)" 
         uri="/mypolicyuri">
      <PolicyReference xmlns="http://schemas.xmlsoap.org/ws/2004/09/policy"
            uri="policy:oracle/wss_username_token_service_policy" />
      <property name="weblogic.sca.binding.ws.usingOwsmPolicies">true</property>
   </binding.ws>
</sca:service>

Example 7-2 Security Configuration for SCA Reference Using an OWSM Policy

The following is an example of security configuration for SCA reference using an OWSM policy:

<sca:reference name="SCAReferenceOwsmUNTPolicy" 
      type="com.oracle.test.SimpleSayHello">
   <binding.ws xmlns="http://xmlns.oracle.com/weblogic/weblogic-sca-binding" 
         location="http://adc2101232:7001/jscaowsm/myowsmuriunt12" 
         port="http://test.oracle.com#wsdl.endpoint(myowsmsvcname/myowsmport)" 
         soapVersion="1.2">
      <PolicyReference xmlns="http://schemas.xmlsoap.org/ws/2004/09/policy"
            uri="policy:oracle/wss_username_token_client_policy" />
      <property name="weblogic.sca.binding.ws.usingOwsmPolicies">true</property>
   </binding.ws>
</sca:reference>

Configuring Databinding

You need to implement databinding by:

  • Specifying the databinding type to use in the databinding attribute of <binding.ws>.

  • Specifying additional details in the <property> subelement of <binding.ws> for SDO and customization files.

For information about configuring different kinds of databinding, see the following topics:

If a databinding type is not specified, toplink.jaxb is used.

Configuring TopLink/EclipseLink JAXB Binding

To configure TopLink/EclipseLink JAXB databinding, enter toplink.jaxb as the value for the databinding attribute in the binding.ws element.

Note:

This is the default databinding type. If nothing is specified for the databinding attribute, toplink.jaxb is used.

The following example represents TopLink/EclipseLink JAXB databinding:

<sca:service 
    name="SCAComplexService" type="com.oracle.test.ComplexHello" 
    target="complexHello">
  <wlsb:binding.ws 
      name="mycomplexsvc" 
      port="mycomplexport" uri="/mycomplexsvcuri" 
      databinding="toplink.jaxb"/>
</sca:service>

Configuring TopLink/EclipseLink SDO Databinding

To configure databinding TopLink/EclipseLink SDO:

  1. In the <binding.ws> element, enter toplink.sdo as the value for the databinding attribute.

  2. In the <property> subelement of <binding.ws>:

    1. Enter weblogic.sca.binding.ws.sdoSchemaFile as the value for the name attribute.

    2. Enter the location of the schema file for the SDO bindings as the content of the element. The path must be relative to the application root, and the schema file must be bundled with the application.

The following example represents TopLink/EclipseLink SDO databinding:

<sca:service name="SCASDOService" 
    type="com.oracle.test.sdo.HelloSDO" target="sdoHello">
  <wlsb:binding.ws
	      name="mysdosvc" 
      port="mysdoport" uri="/mysdosvcuri" 
	      databinding="toplink.sdo">
	    <property name="weblogic.sca.binding.ws.sdoSchemaFile">
       MySDO.xsd
    </property>
	  </wlsb:binding.ws>
</sca:service>

Configuring Glassfish JAXB Databinding

If you need to configure Glassfish JAXB databinding, enter glassfish.jaxb as the value for the databinding attribute in the binding.ws element.

The following example represents GlassFish JAXB binding:

<sca:service 
    name="SCAComplexService" type="com.oracle.test.ComplexHello" 
    target="complexHello">
  <wlsb:binding.ws 
      name="mycomplexsvc" 
      port="mycomplexport" uri="/mycomplexsvcuri" 
      databinding="glassfish.jaxb"/>
</sca:service>

About Configuring Custom Databinding

You can provide an external databinding customization XML file that provides additional information on the Web Service binding. This file provides mapping metadata to define the attributes of a Java Web Service endpoint. The external customization file can be used to customize both WSDL and schema.

One example scenario of the use of the customization file is when the contract class for an SCA service contains overloaded methods that you want to expose as Web Service operations. The customization file can be used to disambiguate operation names for the Web Service.

Another example scenario (schema customization) is to change the name or the order of elements in a generated complex type.

Configuring Custom Databinding

To configure custom databinding:

  1. Create the customization file in the same location as the implementation class file. The schema for the customization file, weblogic-wsee-databinding.xsd, must also be bundled with the application.

    See WebLogic SCA Databindings Customization Descriptor Schema (weblogic-wsee-databinding.xsd) for the schema.

    This schema defines three kinds of XML constructs:

    1. Constructs that are analogous to those in JAX-WS and JSR 181 (Web Services Metadata for the Java Platform). These constructs (a) override or define attributes on the Service Endpoint Interface (SEI) and (b) override or specify information that would normally be part of Java Architecture for XML Binding (JAXB) annotations for the value types used in the interfaces of the SEI.

    2. Additional mapping specifications not available using standard JAX-WS or JAXB annotations, primarily for use with the java.util.Collections API.

    3. References to external JAXB mapping metadata from a Toplink Object-XML (OXM) file. This is only relevant for the toplink.jaxb databinding.

    When a construct is the direct analog of a JAX-WS, JSR 181, or JAXB annotation, the schema includes a comment with notation such as:

    Corresponding Java annotation javax.jws.WebParam.Mode
    
  2. In the <property> subelement of <binding.ws>:

    • Enter weblogic.sca.binding.ws.externalCustomizationFile as the value for the name attribute.

    • Enter the name of the customization file as the content of the <property> element.

Custom Databinding Examples

The following example represents the <property> element that is configured to point to a customization file:

<sca:service name="SCAServiceOverloaded" 
    type="com.oracle.test.SayHelloOverloaded" target="overloadedHello">
  <wlsb:binding.ws" 
      name="myoverloadedsvcname" port="myoverloadedportname" 
      uri="/myoverloadedsvcnameuri">
    <property 
       name="weblogic.sca.binding.ws.externalCustomizationFile">overloading_mapping_file.xml
    </property>
     </wlsb:binding.ws>
  </sca:service>

A sample customization file is shown in the following example. It shows how an overloaded sayHello() method in the POJO is to be supported. The methods are mapped to two operations in the WSDL called sayHello and sayHelloWithString.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<java-wsdl-mapping name="com.oracle.test.SayHelloOverloaded"
      xmlns="http://xmlns.oracle.com/weblogic/weblogic-wsee-databinding"
      xmlns:oxm="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
      databinding="toplink.jaxb">
  <java-methods>
  <java-method name="sayHello">
     <web-method operation-name="sayHello"/>
  </java-method>
  <java-method name="sayHello">
     <web-method operation-name="sayHelloWithString"/>
     <java-params>
         <java-param java-type="java.lang.String"/>
     </java-params>
  </java-method>
  </java-methods>
</java-wsdl-mapping>

The customization file shown below in the following example illustrates the use of an inline <toplink-oxm> element to customize the order of elements in the generated schema. This example specifies that the schema generated for the ShoppingCartItem object includes the quantity, price, and id properties in the specified order instead of the default ordering.

<java-wsdl-mapping name="com.oracle.test.GetPriceRemote"
      xmlns="http://xmlns.oracle.com/weblogic/weblogic-wsee-databinding"
      xmlns:oxm="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
      databinding="toplink.jaxb">
  <xml-schema-mapping>
    <toplink-oxm java-package="com.oracle.test">
      <oxm:xml-bindings>
        <oxm:xml-schema/>
        <oxm:java-types>
          <oxm:java-type name="com.oracle.test.ShoppingCartItem">
            <oxm:xml-type prop-order="quantity price id"/>
          </oxm:java-type>
        </oxm:java-types>
      </oxm:xml-bindings>
    </toplink-oxm>
  </xml-schema-mapping>
</java-wsdl-mapping>

Configuring Databinding for SOAP Attachments

Simple Object Access Protocol, (SOAP) attachments are supported when using TopLink/EclipseLink JAXB databinding. These types are supported:

  • SOAP Message Transmission Optimization Mechanism (MTOM)

  • SOAP Messages with Attachments (SwA)

To configure databinding for SOAP attachments:

  1. Specify TopLink/EclipseLink JAXB databinding by entering toplink.jaxb as the value for the databinding attribute in the binding.ws element.

    Note:

    In practice, this step is not necessary, because toplink.jaxb is the default value for databinding. However, you cannot use any other value for databinding.

  2. Configure for MTOM or SwA, as described in the following topics:
Configuring Attachments Using MTOM

You can enable MTOM in either of the following ways:

  1. Put an @MTOM annotation on an SEI or contract class, as shown in the following example. This enables MTOM for base64Binary types.
    @MTOM
    public class SayHelloMtom {
    public HasArray modifyArray(String name, int b) {
        HasArray ha = new HasArray();
        ha.b = b;
        ha.arr = ("<?xml version='1.0' ?><z>" + name + "</z>").getBytes();
        return ha;
        }
    }
  2. Include a <mtom> element as an immediate child of the <java-wsdl-mapping> element in the external mapping file, as shown in the following example. The attributes for the <mtom> element are optional. The default for enabled is true, and the default for threshold is 0.
    <java-wsdl-mapping name="com.hello.sei.MyServiceEndpointInterface"
      <web-service name="hello-ws" target-namespace="hello-ns"/>
      <mtom enabled="true" threshold="50"/>
      ...

The examples illustrated in Configuring Attachments Using MTOM: Examples use an external customization file to enable MTOM on an SCA POJO to be used as a Web Service endpoint.

Configuring Attachments Using MTOM: Examples

Example 7-3 Spring Context

The following example shows the Spring context, with a reference to the external customization file mtomCustomizationMapping.xml.

<sca:service name="SCAMtomService" type="com.oracle.test.SayHelloMtom" target="helloMtom">
  <binding.ws 
      xmlns="http://xmlns.oracle.com/weblogic/weblogic-sca-binding" 
      name="myMtomSvc" 
      port="myMtomPort" 
      uri="/myMtomSvcUri" 
      databinding="toplink.jaxb">
	    <property 
        name="weblogic.sca.binding.ws.externalCustomizationFile">mtomCustomizationMapping.xml
    </property>
	  </binding.ws>
</sca:service>

Example 7-4 External Customization File mtomCustomizationMapping.xml

The following example shows the external customization file mtomCustomizationMapping.xml.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<java-wsdl-mapping name="com.oracle.test.SayHelloMtom"
    xmlns="http://xmlns.oracle.com/weblogic/weblogic-wsee-databinding"
    xmlns:oxm="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
    databinding="toplink.jaxb">
  <xml-schema-mapping>
    <toplink-oxm java-package="com.oracle.test">
	      <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
	        <java-types>
          <java-type name="com.oracle.test.HasArray">
            	<java-attributes>
              <xml-element java-attribute="arr" xml-mime-type="text/xml" />
            </java-attributes>
	          </java-type>
        </java-types>
  	    </xml-bindings>
    </toplink-oxm>
  </xml-schema-mapping>
  <mtom threshold="2"/>
</java-wsdl-mapping>

Example 7-5 Java Classes

The following example shows the Java classes.

//SayHelloMtom.java
public class SayHelloMtom {
	    public HasArray modifyArray(String name, int b) {		
		        HasArray ha = new HasArray();
		          ha.b = b;
		          ha.arr = ("<?xml version='1.0' ?><z>" + name + "</z>").getBytes();
		          return ha;
	    }
}
 
//HasArray.java
package com.oracle.test;
 
public class HasArray {
    public byte[] arr = "<?xml version='1.0' ?><xy/>".getBytes();
    public int b = 5;
}
Configuring Attachments Using SwA

The SwA attachment type SwaRef is supported in two ways:

  1. Use the @XmlAttachmentRef annotation on a DataHandler type parameter and/or return type, as shown in the following example:

    @XmlAttachmentRef
    DataHandler echoDataHandler(@XmlAttachmentRef DataHandler dh);
  2. Use the xml-attachment-ref attribute in the external customization file, as shown in the following example.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <java-wsdl-mapping name="com.oracle.test.SayHelloSwa"
               xmlns="http://xmlns.oracle.com/weblogic/weblogic-wsee-databinding"
               xmlns:oxm="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
               databinding="toplink.jaxb">
        <xml-schema-mapping>
          <toplink-oxm java-package="com.oracle.test">
    	    <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
    	      <java-types>
                    <java-type name="com.oracle.test.HasDataHandler">
    		  <java-attributes>
                        <xml-element java-attribute="data" xml-attachment-ref="true" />
                      </java-attributes>
    	        </java-type>
                  </java-types>
    	    </xml-bindings>
          </toplink-oxm>
        </xml-schema-mapping>
    </java-wsdl-mapping>

For examples, see Configuring Attachments Using SwA: Examples.

Configuring Attachments Using SwA: Examples
Example 7-6 and Example 7-7show SwA enabled on an SCA POJO to be used as a Web Service endpoint. An alternative to using a wrapper class like the HasDataHandler class is to use the DataHandler as a parameter to the Web Service directly. To do so, you must modify the customization file as shown in Example 7-8. The corresponding SayHelloSwa.java file is shown in Example 7-9.

Example 7-6 Spring Context with Reference to External Customization File

The following example shows the Spring context with reference to an external customization file.

<sca:service name="SCAMtomService" type="com.oracle.test.SayHelloSwa" target="helloSwa">
  <binding.ws 
      xmlns="http://xmlns.oracle.com/weblogic/weblogic-sca-binding" 
      name="mySwaSvc" 
      port="mySwaPort" 
      uri="/mySwaSvcUri" 
      databinding="toplink.jaxb">
 	   <property 
        name="weblogic.sca.binding.ws.externalCustomizationFile">swaCustomizationMapping.xml
    </property>
	  </binding.ws>
  </sca:service>

Example 7-7 Java Classes

This example demonstrates using Java Classes to enable SwA on an SCA POJO to be used as a Web Service endpoint.

//SayHelloSwa.java
package com.oracle.test;
 
public class SayHelloSwa {
        public HasDataHandler echoDataHandler(HasDataHandler dh) {
                return dh;
        }
}
 
//HasDataHandler.java
package com.oracle.test;
 
import javax.activation.DataHandler;
 
public class HasDataHandler {
        public DataHandler data;
}

Example 7-8 Customization File Using a DataHandler as a Parameter to a Web Service

This example shows how to use DataHandler as a parameter to a Web Service. This is an alternative to using a wrapper class like the HasDataHandler class.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<java-wsdl-mapping name="com.oracle.test.SayHelloSwa"
           xmlns="http://xmlns.oracle.com/weblogic/weblogic-wsee-databinding"
           xmlns:oxm="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
           databinding="toplink.jaxb">
   <java-methods>
   <java-method name="echoDataHandler">
      <java-params>
          <java-param>
             <oxm:xml-element xml-attachment-ref="true" xml-mime-type="text/xml"/>
          </java-param>
      </java-params>
   </java-method>
   </java-methods>
</java-wsdl-mapping>

Example 7-9 Java Class

This example shows how to use the Java file, SayHelloSwa.java, corresponding to the DataHandler parameter used in the above example.

//SayHelloSwa.java
package com.oracle.test;
 
import javax.activation.DataHandler;
import javax.mail.util.ByteArrayDataSource;
 
public class SayHelloSwa {
        public DataHandler echoDataHandler(DataHandler dh) {
                byte[] b = new byte[1024];
                try {
                        int len = dh.getInputStream().read(b);
                        String resp = "<swarefresponse>" + new String(b,0,len) + "</swarefresponse>"; 
                        return new DataHandler(new ByteArrayDataSource(resp.getBytes(), "text/xml"));
                } catch (Exception e) {
                        String err = "<err>An error occurred: " + e.getClass().getName() + " - " + e.getMessage() + "</err>";
                        return new DataHandler(new ByteArrayDataSource(err.getBytes(), "text/xml"));
                }
        }
}
s

Configuring Collection and Map Objects

Java Collection and Map objects are supported when using TopLink/EclipseLink JAXB databinding.

Note:

Built in Java subclasses of java.util.List and java.util.Map are supported. Multi-dimensional support (that is, Array of Arrays, Array of HashMaps, List of Lists, etc) will be supported in a future release

You can express the generics type argument of a Collection (or members of the Collection family) with either an annotation or an external mapping file. For example, the two methods in the interface that is shown in Example 7-10 are equivalent in their input types if the processItems2 method uses the external mapping file that is shown in Example 7-11.

Example 7-10 Methods in an Interface (1)

The following example shows two methods in an interface.

public interface CollectionProcessor {
      public String processItems1(Collection<ItemType> items);
      public String processItems2(Collection items);
}

Example 7-11 External Mapping File for Configuring Collection Objects [1]

The following example shows the fragment of the external mapping file for the processItems2 method shown in

<java-method name="processItems2">
  <java-params>
    <java-param>
      <oxm:xml-element type="mypackage.ItemType"/>
    </java-param>
  </java-params>
</java-method>

Example 7-12 External Mapping File for Configuring Collection Objects [2]

The following is another example of an external mapping file for configuring Collection objects.

<java-method name="testListOfCustomer">
  <java-params>
    <java-param>
      <oxm:xml-element type="mypackage.Customer"/>
    </java-param>
  </java-params>
</java-method>

Externalizing Generic Type for Map

Currently, externalizing the generic types is not directly supported for java.util.Map types.

However, if it is not possible to specify the generic type for the Map directly in the Java class, it can be indirectly supported by using the Java XML type adapter feature of the toplink.jaxb binding. This involves writing custom serializers for the desired generic Map types and specifying the custom serializers in the external mapping file, as shown in.

Example 7-13 POJO to be Exposed as a Web Service (Without Generic Types on the Map)

The following example demonstrates POJO that can be exposed as a Web Service.

//Implementation class
public class CollectionMapExtTypeArgImpl {
  public Map testMapOfCustomAdapters(Map map) {
      //implementation goes here
  }
}

Example 7-14 Custom Adapter Classes

The following example specifies the custom adapter classes.

//Custom Adapter class for Map<String, Integer> (JAXB Xml Adapter)
public class MapStringIntegerAdapter extends XmlAdapter<MapStringInteger, HashMap> {
  public HashMap unmarshal(MapStringInteger m) throws Exception {
    HashMap map = new HashMap();
    for (StringIntegerEntry e: m.entry) map.put(e.key, e.value);
    return map;
  }
  public MapStringInteger marshal(HashMap m) throws Exception {
    MapStringInteger map = new MapStringInteger();
    map.entry = new ArrayList<StringIntegerEntry>();
    for (Object k: m.keySet()) {
      StringIntegerEntry e = new StringIntegerEntry();
      e.key = (String) k;
      e.value = (Integer) m.get(k);
      map.entry.add(e);
    }
    return map;
  }
}
 
//MapStringInteger.java
public class MapStringInteger {
  public static class StringIntegerEntry {
    @XmlAttribute
    public String key;   
    @XmlValue
    public Integer value;
  }  
  public List<StringIntegerEntry> entry;
}
 
//Similar implementation for MapStringCustomerAdapter would be needed

Example 7-15 Customization file fragment showing return type of Map<String, Integer> and parameter type of Map<String, Customer>

The following example demonstrates the customization file fragment showing return type of Map<String, Integer> and parameter type of Map<String, Customer>.

<java-method name="testMapOfCustomAdapters">
     <oxm:xml-element xmlns='http://www.eclipse.org/eclipselink/xsds/persistence/oxm'>
       <oxm:xml-java-type-adapter value='com.oracle.test.MapStringIntegerAdapter'/>
     </oxm:xml-element>
     <java-params>
         <java-param>
            <oxm:xml-element xmlns='http://www.eclipse.org/eclipselink/xsds/persistence/oxm'>
              <oxm:xml-java-type-adapter value='com.oracle.test.MapStringCustomerAdapter'/>
            </oxm:xml-element>
         </java-param>
     </java-params>
  </java-method>

Precedence of Configuration Settings

You can specify several configuration settings in more than one place, including databinding mode, SOAP version, target namespace, service name, and port name. If one of those settings is specified in multiple places, they are evaluated in the following order of precedence:

  1. If a configuration option is specified (and is not empty) in the Spring context in the binding.ws configuration, that setting is used. This setting takes precedence over all others.

  2. If a configuration option is not specified in the Spring context in the binding.ws configuration, the value in the external customization file is used. This setting takes precedence over the next setting mentioned below.

  3. If a configuration option is not specified in the Spring context or the external customization file but is specified in annotations on the POJO, the annotations on the POJO are used.

Deployment

At deployment, WebLogic SCA Runtime:

  1. Uses the service interface information to generate a WSDL.

  2. Publishes the service at the specified URI (relative to the context root) as a JAX-WS endpoint.

Runtime

The runtime behavior of Web Service bindings is described as follows:

  • Service Requests— Requests to services are handled in the following manner:

    1. The appropriate data binding converts the incoming SOAP message payload into Java objects.

    2. Any policies are handled by the JAX-WS runtime.

    3. The POJO implementing the service is invoked by the WebLogic SCA Runtime.

  • Reference Invocations— WebLogic SCA Runtime recognizes that a reference invocation is for an external reference. It acts as a JAX-WS client to the external Web Service, unmarshals the result to Java and returns it in a manner transparent to the calling Java code.