Invoking Another Web Service from the JWS File Using SOAP 1.2

Programming the JWS File 4-17 import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; Import the WebLogic-specific JWS annotation interface Import the BasicStruct JavaBean import examples.webservices.complex.BasicStruct; WebServiceserviceName=ComplexService, name=ComplexPortType, targetNamespace=http:example.org ... public class ComplexImpl { WebMethodoperationName=echoComplexType public BasicStruct echoStructBasicStruct struct { return struct; } }

4.7 Invoking Another Web Service from the JWS File

From within your JWS file you can invoke another Web service, either one deployed on WebLogic Server or one deployed on some other application server, such as .NET. The steps to do this are similar to those described in Section 2.4, Invoking a Web Service from a Java SE Application, except that rather than running the clientgen Ant task to generate the client stubs, you include a clientgen child element of the jwsc Ant task that builds the invoking Web service to generate the client stubs instead. You then use the standard JAX-WS APIs in your JWS file, the same as you do for a Java SE client application. See Section 6.3, Invoking a Web Service from a WebLogic Web Service for detailed instructions.

4.8 Using SOAP 1.2

WebLogic Web services use, by default, Version 1.1 of Simple Object Access Protocol SOAP as the message format when transmitting data and invocation calls between the Web service and its client. WebLogic Web services support both SOAP 1.1 and the newer SOAP 1.2, and you are free to use either version. To specify that the Web service use Version 1.2 of SOAP, use the class-level javax.xml.ws.BindingTyp annotation in your JWS file and set its single attribute to the value SOAPBinding.SOAP12HTTP_BINDING, as shown in the following example relevant code shown in bold: package examples.webservices.soap12; import javax.jws.WebMethod; import javax.jws.WebService; import javax.xml.ws.BindingType; import javax.xml.ws.SOAPBinding; WebServicename=SOAP12PortType, serviceName=SOAP12Service, targetNamespace=http:example.org BindingTypevalue = SOAPBinding.SOAP12HTTP_BINDING This JWS file forms the basis of simple Java-class implemented WebLogic Web Service with a single operation: sayHello. The class uses SOAP 1.2 as its binding. 4-18 Getting Started With JAX-WS Web Services for Oracle WebLogic Server public class SOAP12Impl { WebMethod public String sayHelloString message { System.out.printlnsayHello: + message; return Here is the message: + message + ; } } Other than set this annotation, you do not have to do anything else for the Web service to use SOAP 1.2, including changing client applications that invoke the Web service; the WebLogic Web services runtime takes care of all the rest.

4.9 Validating the XML Schema