<xsdOption>
<extension>true</extension>
<xsd>${project.xsd.schemas.source.path}/examples.xsd</xsd>
+ <bindingFile>${project.xsd.schemas.source.path}/custombinding.xjb</bindingFile>
<packagename>${project.xsd.schemas.package.name}</packagename>
<extensionArgs>
<extraarg>-Xinheritance</extraarg>
<sourceRoot>${project.xsd.schemas.target.path}</sourceRoot>
<wsdlOptions>
<wsdlOption>
+ <!--
<wsdl>${project.wsdl.sources.path}/example.wsdl</wsdl>
+ -->
+ <wsdl>${project.wsdl.sources.path}/custombindingexample.wsdl</wsdl>
<extraargs>
<extraarg>-xjc-Xinheritance</extraarg>
</extraargs>
--- /dev/null
+package de.spring.webservices.business;
+
+import de.spring.webservices.auto.CustomBindingExampleRequest;
+import de.spring.webservices.auto.CustomBindingExampleResponse;
+import de.spring.webservices.auto.ObjectFactory;
+import de.spring.webservices.operations.Operations;
+
+/**
+ * Example of business class
+ *
+ */
+public class CustomBindingBusinessExample
+ implements Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> {
+
+ @Override
+ public CustomBindingExampleResponse requestResponse(final CustomBindingExampleRequest request) {
+ final CustomBindingExampleResponse response = new ObjectFactory().createCustomBindingExampleResponse();
+
+ response.setData("CUSTOM BINDING SNAKE EYES AND " + request.getData());
+
+ return response;
+ }
+
+}
package de.spring.webservices.client;
+import localhost._8888.spring_ws.example.CustomBindingExampleRequest;
+import localhost._8888.spring_ws.example.CustomBindingExampleResponse;
import localhost._8888.spring_ws.example.ExampleRequest;
import localhost._8888.spring_ws.example.ExampleResponse;
import localhost._8888.spring_ws.example.Examples;
public void sendAndReceive() {
final Examples exampleService = new ExamplesService().getExamplesSoap11();
final ExampleRequest exampleRequest = new ObjectFactory().createExampleRequest();
+ final CustomBindingExampleRequest customBindingxampleRequest =
+ new ObjectFactory().createCustomBindingExampleRequest();
exampleRequest.setData("SCARLETT. IT IS CANON.");
+ customBindingxampleRequest.setData("CUSTOM BINDING. SCARLETT. IT IS CANON.");
//There are two options O.o:
//1. Through Java:
ExampleResponse exampleResponse = exampleService.example(exampleRequest);
System.out.println(exampleResponse.getData());
+ CustomBindingExampleResponse customBindingExampleResponse =
+ exampleService.customBindingExample(customBindingxampleRequest);
+ System.out.println(customBindingExampleResponse.getData());
//2. Using Spring:
this.webServiceTemplate.setDefaultUri(this.Uri);
exampleResponse = (ExampleResponse)
this.webServiceTemplate.marshalSendAndReceive(exampleRequest);
+ this.webServiceTemplate.setDefaultUri(this.Uri);
+ customBindingExampleResponse = (CustomBindingExampleResponse) this.webServiceTemplate
+ .marshalSendAndReceive(customBindingxampleRequest);
System.out.println(exampleResponse.getData());
+ System.out.println(customBindingExampleResponse.getData());
}
}
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
+import de.spring.webservices.auto.CustomBindingExampleRequest;
+import de.spring.webservices.auto.CustomBindingExampleResponse;
import de.spring.webservices.auto.ExampleRequest;
import de.spring.webservices.auto.ExampleResponse;
import de.spring.webservices.operations.Operations;
public class ExampleEndPoint {
private static final String NAMESPACE_URI = "http://localhost:8888/spring-ws/example";
private Operations.RequestResponse<ExampleResponse, ExampleRequest> example;
+ private Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExample;
public ExampleEndPoint() {}
return example.requestResponse(requestObject);
}
+ @PayloadRoot(localPart = "CustomBindingExampleRequest", namespace = NAMESPACE_URI)
+ @ResponsePayload
+ public CustomBindingExampleResponse order(
+ @RequestPayload final CustomBindingExampleRequest requestObject,
+ @RequestPayload final Element element,
+ final MessageContext messageContext) {
+
+ return this.customBindingExample.requestResponse(requestObject);
+ }
+
/** Setter required by Spring **/
public void setExample(
final Operations.RequestResponse<ExampleResponse, ExampleRequest> example) {
this.example = example;
}
+
+ public void setCustomBindingExample(
+ final Operations.RequestResponse<CustomBindingExampleResponse, CustomBindingExampleRequest> customBindingExample) {
+ this.customBindingExample = customBindingExample;
+ }
}
<sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>
-->
<sws:annotation-driven/>
-
+
+ <!--
+ Spring makes the WSDL file for us from the XSD file.
+ Launch the Jetty server and download WSDL file from this URL: http://127.0.0.1:8888/spring-ws/example/example.wsdl
+ -->
<sws:dynamic-wsdl id="example"
portTypeName="Examples"
locationUri="/spring-ws/example">
<bean id="exampleBusiness" class="de.spring.webservices.business.BusinessExample">
</bean>
+
+ <bean id="customBindingExampleBusiness" class="de.spring.webservices.business.CustomBindingBusinessExample">
+ </bean>
<bean id="exampleEndPoint" class="de.spring.webservices.endpoints.ExampleEndPoint" >
<property name="example" ref="exampleBusiness" />
+ <property name="customBindingExample" ref="customBindingExampleBusiness" />
</bean>
+
</beans>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://localhost:8888/spring-ws/example" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost:8888/spring-ws/example" targetNamespace="http://localhost:8888/spring-ws/example">
+ <wsdl:types>
+ <xs:schema xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance" jaxb:version="2.1" targetNamespace="http://localhost:8888/spring-ws/example">
+
+
+ <xs:element name="ExampleRequest">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:appinfo>
+ <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="data" type="xs:string"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ExampleResponse">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:appinfo>
+ <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="data" type="xs:string"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="CustomBindingExampleRequest">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:appinfo>
+ <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="data" type="xs:string"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="CustomBindingExampleResponse">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:appinfo>
+ <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:all>
+ <xs:element name="data" type="xs:string"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+
+
+</xs:schema>
+ </wsdl:types>
+ <wsdl:message name="CustomBindingExampleResponse">
+ <wsdl:part element="tns:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="CustomBindingExampleRequest">
+ <wsdl:part element="tns:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="ExampleRequest">
+ <wsdl:part element="tns:ExampleRequest" name="ExampleRequest">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="ExampleResponse">
+ <wsdl:part element="tns:ExampleResponse" name="ExampleResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Examples">
+ <wsdl:operation name="CustomBindingExample">
+ <wsdl:input message="tns:CustomBindingExampleRequest" name="CustomBindingExampleRequest">
+ </wsdl:input>
+ <wsdl:output message="tns:CustomBindingExampleResponse" name="CustomBindingExampleResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="Example">
+ <wsdl:input message="tns:ExampleRequest" name="ExampleRequest">
+ </wsdl:input>
+ <wsdl:output message="tns:ExampleResponse" name="ExampleResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ExamplesSoap11" type="tns:Examples">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="CustomBindingExample">
+ <soap:operation soapAction=""/>
+ <wsdl:input name="CustomBindingExampleRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="CustomBindingExampleResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="Example">
+ <soap:operation soapAction=""/>
+ <wsdl:input name="ExampleRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="ExampleResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExamplesService">
+ <wsdl:port binding="tns:ExamplesSoap11" name="ExamplesSoap11">
+ <soap:address location="http://127.0.0.1:8888/spring-ws/example"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://localhost:8888/spring-ws/example" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost:8888/spring-ws/example" targetNamespace="http://localhost:8888/spring-ws/example">
- <wsdl:types>
- <xs:schema xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance" jaxb:version="2.1" targetNamespace="http://localhost:8888/spring-ws/example">
-
-
- <xs:element name="ExampleRequest">
- <xs:complexType>
- <xs:annotation>
- <xs:appinfo>
- <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
- </xs:appinfo>
- </xs:annotation>
- <xs:all>
- <xs:element name="data" type="xs:string"/>
- </xs:all>
- </xs:complexType>
- </xs:element>
- <xs:element name="ExampleResponse">
- <xs:complexType>
- <xs:annotation>
- <xs:appinfo>
- <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
- </xs:appinfo>
- </xs:annotation>
- <xs:all>
- <xs:element name="data" type="xs:string"/>
- </xs:all>
- </xs:complexType>
- </xs:element>
-</xs:schema>
- </wsdl:types>
- <wsdl:message name="ExampleRequest">
- <wsdl:part element="tns:ExampleRequest" name="ExampleRequest">
- </wsdl:part>
- </wsdl:message>
- <wsdl:message name="ExampleResponse">
- <wsdl:part element="tns:ExampleResponse" name="ExampleResponse">
- </wsdl:part>
- </wsdl:message>
- <wsdl:portType name="Examples">
- <wsdl:operation name="Example">
- <wsdl:input message="tns:ExampleRequest" name="ExampleRequest">
- </wsdl:input>
- <wsdl:output message="tns:ExampleResponse" name="ExampleResponse">
- </wsdl:output>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="ExamplesSoap11" type="tns:Examples">
- <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="Example">
- <soap:operation soapAction=""/>
- <wsdl:input name="ExampleRequest">
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="ExampleResponse">
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="ExamplesService">
- <wsdl:port binding="tns:ExamplesSoap11" name="ExamplesSoap11">
- <soap:address location="http://localhost:8888/spring-ws/example"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
+ jaxb:version="2.1"
+ jaxb:extensionBindingPrefixes="inheritance">
+
+ <!--
+ Se procesa con Xpath si quieres meter expresiones regulares y cosas así en teoría dependes de Xpath
+ por ejemplo esto: @name=match[.] se supone que debería funcionar pero me dice que no puede
+ cambiar mas de un nodo a la vez. Puede que sea un bug de xjc que se carga las opciones de Xpath :/
+ <jaxb:bindings schemaLocation="examples.xsd">
+ <jaxb:bindings node="//xsd:element[@name='ExampleRequest']/xsd:complexType">
+ <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+ </jaxb:bindings>
+ <jaxb:bindings node="//xsd:element[@name='ExampleResponse']/xsd:complexType">
+ <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+ </jaxb:bindings>
+ </jaxb:bindings>
+ -->
+
+ <jaxb:bindings schemaLocation="examples.xsd">
+ <jaxb:bindings node="//xsd:element[@name='CustomBindingExampleRequest']/xsd:complexType">
+ <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements>
+ </jaxb:bindings>
+ </jaxb:bindings>
+
+
+ <jaxb:bindings schemaLocation="examples.xsd">
+ <jaxb:bindings node="//xsd:element[@name='CustomBindingExampleResponse']/xsd:complexType">
+ <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements>
+ </jaxb:bindings>
+ </jaxb:bindings>
+
+</jaxb:bindings>
</xs:all>
</xs:complexType>
</xs:element>
+
+ <xs:element name="CustomBindingExampleRequest">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="data" type="xs:string" />
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="CustomBindingExampleResponse">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="data" type="xs:string" />
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+
+
</xs:schema>