Commits

Hector Miuler Malpica Gallegos committed 4e17bd3

Probando devolver un objecto complejo.

Comments (0)

Files changed (4)

src/main/java/com/miuler/demo/cxf_spring/HelloWorld.java

 
 	@WebMethod
     String sayHi(String text);
+
+	@WebMethod
+	User getUser(Integer userId);
 }
 

src/main/java/com/miuler/demo/cxf_spring/HelloWorld.wsdl

-<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions name="HelloWorldService" targetNamespace="http://cxf_spring.demo.miuler.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://cxf_spring.demo.miuler.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
-  <wsdl:types>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://cxf_spring.demo.miuler.com/" elementFormDefault="unqualified" targetNamespace="http://cxf_spring.demo.miuler.com/" version="1.0">
-<xs:element name="sayHi" type="tns:sayHi"/>
-<xs:element name="sayHiResponse" type="tns:sayHiResponse"/>
-<xs:complexType name="sayHi">
-    <xs:sequence>
-      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
-    </xs:sequence>
-  </xs:complexType>
-<xs:complexType name="sayHiResponse">
-    <xs:sequence>
-      <xs:element minOccurs="0" name="return" type="xs:string"/>
-    </xs:sequence>
-  </xs:complexType>
-</xs:schema>
-  </wsdl:types>
-  <wsdl:message name="sayHi">
-    <wsdl:part name="parameters" element="tns:sayHi">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:message name="sayHiResponse">
-    <wsdl:part name="parameters" element="tns:sayHiResponse">
-    </wsdl:part>
-  </wsdl:message>
-  <wsdl:portType name="HelloWorld">
-    <wsdl:operation name="sayHi">
-      <wsdl:input name="sayHi" message="tns:sayHi">
-    </wsdl:input>
-      <wsdl:output name="sayHiResponse" message="tns:sayHiResponse">
-    </wsdl:output>
-    </wsdl:operation>
-  </wsdl:portType>
-  <wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorld">
-    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-    <wsdl:operation name="sayHi">
-      <soap:operation soapAction="" style="document"/>
-      <wsdl:input name="sayHi">
-        <soap:body use="literal"/>
-      </wsdl:input>
-      <wsdl:output name="sayHiResponse">
-        <soap:body use="literal"/>
-      </wsdl:output>
-    </wsdl:operation>
-  </wsdl:binding>
-  <wsdl:service name="HelloWorldService">
-    <wsdl:port name="HelloWorldPort" binding="tns:HelloWorldServiceSoapBinding">
-      <!--<soap:address location="http://localhost:9090/HelloWorldPort"/>-->
-      <soap:address location="http://localhost:8080/cxf-spring/ws/HelloWorld"/>
-    </wsdl:port>
-  </wsdl:service>
-</wsdl:definitions>

src/main/java/com/miuler/demo/cxf_spring/HelloWorldWS.java

 		log.warn("Prueba 1");
         return "Hello " + text;
     }
+
+	@Override
+	public User getUser(Integer userId) {
+		return new User("Pepito", 28);
+	}
+
 }
 

src/main/java/com/miuler/demo/cxf_spring/User.java

+package com.miuler.demo.cxf_spring;
+
+import java.io.Serializable;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: miuler
+ * Date: 20/11/12
+ * Time: 11:37 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class User implements Serializable {
+
+	private String name;
+	private Integer age;
+
+	public User() {
+
+	}
+
+	public User(String name, Integer age) {
+		this.name = name;
+		this.age = age;
+	}
+
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Integer getAge() {
+		return age;
+	}
+
+	public void setAge(Integer age) {
+		this.age = age;
+	}
+}