[JBossWS] - send HaspMap<String, ArrayList<String>> over WS
by peiguo
I have getter/setter defined for properties, but still cannot send object of this class through WS, because the JBOSS generated WSDL doesn't include correct information for ArrayList. How can I correct this?
| package org.jboss.tutorial.webservice.bean;
|
| import java.util.*;
| import java.io.*;
|
| public class Something {
| private int a;
| private double b;
|
|
| private HashMap<String, ArrayList<String>> c;
|
| public Something() {
| a = 1;
| b = 2.0;
| c = new HashMap<String, ArrayList<String>>();
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("This is fun");
| arr.add("Interesting");
| arr.add("What is this?");
| c.put("thought", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("Kaveh");
| arr.add("David");
| arr.add("Costa");
| c.put("name", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("green apple");
| arr.add("orange orange");
| arr.add("yellow mango");
| c.put("fruit", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("they shoot horse");
| arr.add("sleppless in seattle");
| arr.add("thank you for smoking");
| c.put("movie", arr);
| }
| }
|
| public int getA() {
| return a;
| }
|
| public void setA(int a) {
| this.a = a;
| }
|
| public double getB() {
| return b;
| }
|
| public void setB(double b) {
| this.b = b;
| }
|
| public HashMap<String, ArrayList<String>> getC() {
| return c;
| }
|
| public void setC(HashMap<String, ArrayList<String>> c) {
| this.c = c;
| }
|
| public ArrayList<String> getC(String i) {
| return c.get(i);
| }
|
| public void setC(String i, ArrayList<String> c) {
| this.c.put(i, c);
| }
|
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148233#4148233
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148233
16 years, 7 months
[JBossWS] - Urgent!! Web service return object - JBopss 4.2.2.GA
by peiguo
Hi,
We are doing some prototyping, JBoss for web service and C# for client. One of the key thing is to return an object from web service. But it did n't seem to work (some kind of limitation???). After some investigation, the problem seems reside on JBoss side, since the WSDL seems missing information.
Interface:
| package org.jboss.tutorial.webservice.bean;
|
| import javax.jws.WebService;
| import javax.jws.WebMethod;
| import java.rmi.Remote;
| import java.rmi.RemoteException;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.Style;
|
|
| @WebService
| @SOAPBinding(style=Style.DOCUMENT)
| public interface Calculator extends Remote
| {
| @WebMethod int add(int x, int y);
|
| @WebMethod int subtract(int x, int y);
| @WebMethod Something dump();
|
| }
|
Implementation:
| package org.jboss.tutorial.webservice.bean;
|
| import javax.ejb.*;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.Style;
| import javax.naming.*;
| import javax.persistence.*;
|
| import java.sql.*;
| import javax.sql.*;
|
| import javax.annotation.Resource;
|
| @Stateless
| @WebService
| @SOAPBinding(style=Style.DOCUMENT)
| public class CalculatorBean
| {
|
| public int add(int x, int y) {
| return x + y;
| }
|
| public int subtract(int x, int y)
| {
| return x - y;
| }
|
| public Something dump() {
| System.out.println("called");
| return new Something();
| }
| }
|
|
Definition of Something:
| package org.jboss.tutorial.webservice.bean;
|
| import java.util.*;
|
| public class Something {
| private int a;
| private double b;
| private HashMap<String, ArrayList<String>> c;
|
| public Something() {
| a = 1;
| b = 2.0;
| c = new HashMap<String, ArrayList<String>>();
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("This is fun");
| arr.add("Interesting");
| arr.add("What is this?");
| c.put("first set", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("Kaveh");
| arr.add("David");
| arr.add("Costa");
| c.put("second set", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("green apple");
| arr.add("orange orange");
| arr.add("yellow mango");
| c.put("third set", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("they shoot horse");
| arr.add("sleppless in seattle");
| arr.add("thank you for smoking");
| c.put("bunch of movies", arr);
| }
| }
| }
|
|
WSDL generated (does not seem to define Something!!!):
| <definitions name='CalculatorBeanService' targetNamespace='http://bean.webservice.tutorial.jboss.org/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://bean.webservice.tutorial.jboss.org/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <xs:schema targetNamespace='http://bean.webservice.tutorial.jboss.org/' version='1.0' xmlns:tns='http://bean.webservice.tutorial.jboss.org/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
| <xs:element name='add' type='tns:add'/>
| <xs:element name='addResponse' type='tns:addResponse'/>
| <xs:element name='dump' type='tns:dump'/>
| <xs:element name='dumpResponse' type='tns:dumpResponse'/>
| <xs:element name='subtract' type='tns:subtract'/>
| <xs:element name='subtractResponse' type='tns:subtractResponse'/>
|
| <xs:complexType name='add'>
| <xs:sequence>
| <xs:element name='arg0' type='xs:int'/>
| <xs:element name='arg1' type='xs:int'/>
| </xs:sequence>
| </xs:complexType>
| <xs:complexType name='addResponse'>
| <xs:sequence>
| <xs:element name='return' type='xs:int'/>
|
| </xs:sequence>
| </xs:complexType>
| <xs:complexType name='dump'>
| <xs:sequence/>
| </xs:complexType>
| <xs:complexType name='dumpResponse'>
| <xs:sequence>
| <xs:element minOccurs='0' name='return' type='tns:something'/>
| </xs:sequence>
|
| </xs:complexType>
| <xs:complexType name='something'>
| <xs:sequence/>
| </xs:complexType>
| <xs:complexType name='subtract'>
| <xs:sequence>
| <xs:element name='arg0' type='xs:int'/>
| <xs:element name='arg1' type='xs:int'/>
| </xs:sequence>
|
| </xs:complexType>
| <xs:complexType name='subtractResponse'>
| <xs:sequence>
| <xs:element name='return' type='xs:int'/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| <message name='CalculatorBean_dumpResponse'>
|
| <part element='tns:dumpResponse' name='dumpResponse'></part>
| </message>
| <message name='CalculatorBean_subtractResponse'>
| <part element='tns:subtractResponse' name='subtractResponse'></part>
| </message>
| <message name='CalculatorBean_subtract'>
| <part element='tns:subtract' name='subtract'></part>
| </message>
| <message name='CalculatorBean_addResponse'>
|
| <part element='tns:addResponse' name='addResponse'></part>
| </message>
| <message name='CalculatorBean_add'>
| <part element='tns:add' name='add'></part>
| </message>
| <message name='CalculatorBean_dump'>
| <part element='tns:dump' name='dump'></part>
| </message>
| <portType name='CalculatorBean'>
|
| <operation name='add' parameterOrder='add'>
| <input message='tns:CalculatorBean_add'></input>
| <output message='tns:CalculatorBean_addResponse'></output>
| </operation>
| <operation name='dump' parameterOrder='dump'>
| <input message='tns:CalculatorBean_dump'></input>
| <output message='tns:CalculatorBean_dumpResponse'></output>
| </operation>
| <operation name='subtract' parameterOrder='subtract'>
|
| <input message='tns:CalculatorBean_subtract'></input>
| <output message='tns:CalculatorBean_subtractResponse'></output>
| </operation>
| </portType>
| <binding name='CalculatorBeanBinding' type='tns:CalculatorBean'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='add'>
| <soap:operation soapAction=''/>
| <input>
|
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| <operation name='dump'>
| <soap:operation soapAction=''/>
| <input>
|
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| <operation name='subtract'>
| <soap:operation soapAction=''/>
| <input>
|
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='CalculatorBeanService'>
| <port binding='tns:CalculatorBeanBinding' name='CalculatorBeanPort'>
|
| <soap:address location='http://127.0.0.1:8080/tutorial/CalculatorBean'/>
| </port>
| </service>
| </definitions>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148127#4148127
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148127
16 years, 7 months
[JBossWS] - Re: Need help : JBossWS Security!
by xinhua
ok,
i see, maybe jboss-wsse-client.xml or standard-jaxws-client-config.xml not loaded ,so i copied the both xml into META-INF and also changed the client code like this:
|
| Service s = Service.create(url, qn);
| Test port = s.getPort(Test.class);
|
| URL securityURL = new File("META-INF/jboss-wsse-client.xml").toURL();
| URL securityConfig= new File("META-INF/standard-jaxws-client-config.xml").toURL();
| ((StubExt) port).setSecurityConfig(securityURL.toExternalForm());
| ((StubExt) port).setConfigName("Standard WSSecurity Client",securityConfig.toExternalForm());
|
|
| ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "kermit");
| ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
| ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:4040/miguoWS/TestBean");
but in soap monitor i found <wsse: Security> is still missing in request.
(jboss4.2.1GA, jbossws-3.0.1-native-2.0.4.GA, jdk1.5 update 15)
Really nobody can help me out here ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148096#4148096
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148096
16 years, 7 months