[JBossWS] - Re: returning array undefined in web service
by mckeno
Hi Alessio,
Here are some more details:
The wsdl schema:
<definitions name="MyService"targetNamespace="http://xxx/yyy/services">
| <types>
| <xs:schema targetNamespace="http://xxx/yyy/services" version="1.0">
| <xs:element name="getNumber" type="tns:getNumber"/>
| <xs:element name="getNumberResponse" type="tns:getNumberResponse"/>
| <xs:complexType name="getNumber">
| <xs:sequence>
| <xs:element minOccurs="0" name="userName" type="xs:string"/>
| </xs:sequence>
| </xs:complexType>
|
| <xs:complexType name="getNumberResponse">
| <xs:sequence>
| <xs:element maxOccurs="unbounded" minOccurs="0" name="numbers" type="xs:int"/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
|
| <message name="Mojo_getNumberResponse">
| <part element="tns:getNumberResponse" name="getNumberResponse"/>
| </message>
|
| <message name="Mojo_getNumber">
| <part element="tns:getNumber" name="getNumber"/>
| </message>
|
| <portType name="Mojo">
| <operation name="getNumber" parameterOrder="getNumber">
| <input message="tns:Mojo_getNumber"/>
| <output message="tns:Mojo_getNumberResponse"/>
| </operation>
| </portType>
|
| <binding name="MojoBinding" type="tns:Mojo">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
| <operation name="getNumber">
| <soap:operation soapAction=""/>
| <input>
| <soap:body use="literal"/>
| </input>
| <output>
| <soap:body use="literal"/>
| </output>
| </operation>
| </binding>
|
| <service name="MojoService">
| <port binding="tns:MojoBinding" name="MojoPort">
| <soap:address location="http://localhost:8080/myService/MyWebService"/>
| </port>
| </service>
| </definitions>
The web service class in EJB container
| @Stateless
| @WebService(name = "Mojo", targetNamespace = "http://xxx/yyy/services", serviceName = "MyService")
| @WebContext(contextRoot="/myService")
| @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
| public class MyWebService {
|
| @SuppressWarnings("unused")
| private Logger log = Logger.getLogger(this.getClass());
|
| @WebMethod
| @WebResult(name = "numbers")
| public int[] getNumber(@WebParam(name = "userName") String sth) {
| int[] number = new int[3];
| number[0] = 7;
| number[1] = 2;
| number[2] = 3;
| System.out.println("Get Number call");
| log.info("ARRAY METHOD CALLED " + number.length);
| return number;
| }
| }
JBoss version : [Server] Release ID: JBoss [Trinity] 4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)
JbossWS: I think i used the one came with the Jboss server, not sure how to check its version...
I did use soapUI to capture the request and respone and it works ok:
request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://xxx/yyy/services">
| <soapenv:Header/>
| <soapenv:Body>
| <ser:getNumber>
| <!--Optional:-->
| <userName>3</userName>
| </ser:getNumber>
| </soapenv:Body>
| </soapenv:Envelope>
response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
| <env:Header/>
| <env:Body>
| <ns2:getNumberResponse xmlns:ns2="http://mojo.streamverse.com/services">
| <numbers>7</numbers>
| <numbers>2</numbers>
| <numbers>3</numbers>
| </ns2:getNumberResponse>
| </env:Body>
| </env:Envelope>
Only that when it is called from the Flash application(flash 7, using WebService Connector) then the results always undefined(non array result works ok in flash).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108757#4108757
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108757
17 years, 1 month
[JBossWS] - Re: Soap service returning complex objects(Such as hashmaps)
by mwkohout
at least in my instance I get the same result as before.
btw, I'm running the version javaws that comes default with jboss 4.2.1GA. I don't suppose this annotation change fixed your issue because you were on the new version of jbossws?
I suppose the next step is to see if it's a parsing error or just a bad response by capturing the envelope in my log.
huh. this is the call that would return a hashmap with one key/value pair in it. To my untrained eyes there isn't anything in the response.
| 17:12:18,874 DEBUG [SOAPContentElement] -----------------------------------
| 17:12:18,874 DEBUG [SOAPContentElement] Transitioning from OBJECT_VALID to XML_VALID
| 17:12:18,874 DEBUG [ObjectContent] getXMLFragment from Object [xmlType={http://webService.core.ictr.umn.edu/}hashMap,javaType=class java.util.HashMap]
| 17:12:18,874 DEBUG [JAXBSerializer] serialize: [xmlName=return,xmlType={http://webService.core.ictr.umn.edu/}hashMap]
| 17:12:18,874 DEBUG [JAXBSerializer] serialized: <return/>
| 17:12:18,874 DEBUG [ObjectContent] xmlFragment: [source=<return/>]
| 17:12:18,874 DEBUG [SOAPContentElement] -----------------------------------
| 17:12:18,875 TRACE [MessageTrace] Outgoing Response Message
| <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
| <env:Header>
| <seam:conversationId xmlns:seam='http://www.jboss.org/seam/webservice'>6</seam:conversationId>
| </env:Header>
| <env:Body>
| <n1:getStudiesResponse xmlns:n1='http://webService.core.ictr.umn.edu/'>
| <return/>
| </n1:getStudiesResponse>
| </env:Body>
| </env:Envelope>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108715#4108715
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108715
17 years, 1 month
[JBossWS] - Java Client Application using Stub with WS-Security
by method_ben
I have some problems to call methods from my web service. I use WS-Security to secure my web service. All necessary files (jboss-wsse-server.xml,jboss-wsse-client.xml, wsse.keystore, wsse.truststore) are in my WAR file.
My stubs are generated by wsconsume.
I have made a java application where I put my stub generated stub. This application is not deployed in JBoss. It's a simple java application with a "main".
Main.java :
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
import org.jboss.ws.core.StubExt;
import com.client.*;
public static void main(String[] args) throws MalformedURLException, NamingException
{
URL url = new URL("http://localhost:8080/test/Test?wsdl");
QName qName = new QName("rrr", "TestService");
TestService service = new TestService(url,qName);
Test ws = service.getPort(Test.class);
((StubExt) ws).setSecurityConfig(new File("etc/jboss-wsse-client.xml").toURI().toURL().toExternalForm());
((StubExt) ws).setConfigName("Standard WSSecurity Client");
ws.hello("Benoit"); // doesnt work !
}
When I execute it, I get that :
Exception in thread "main" javax.xml.ws.WebServiceException: org.jboss.ws.core.CommonSOAPFaultException: An internal WS-Security error occurred. See log for details
at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.processHandlerFailure(HandlerChainExecutor.java:276)
at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:155)
at org.jboss.ws.core.jaxws.client.ClientImpl.callRequestHandlerChain(ClientImpl.java:160)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:297)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
at $Proxy14.hello(Unknown Source)
at com.main.MainTest.main(MainTest.java:51)
Caused by: org.jboss.ws.core.CommonSOAPFaultException: An internal WS-Security error occurred. See log for details
at org.jboss.ws.extensions.security.WSSecurityDispatcher.convertToFault(WSSecurityDispatcher.java:105)
at org.jboss.ws.extensions.security.WSSecurityDispatcher.handleOutbound(WSSecurityDispatcher.java:314)
at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleOutboundSecurity(WSSecurityHandler.java:95)
at org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient.handleOutbound(WSSecurityHandlerClient.java:45)
at org.jboss.ws.core.jaxws.handler.GenericHandler.handleMessage(GenericHandler.java:55)
at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:295)
at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:140)
... 7 more
Anyone knows how I can resolve my problem ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108685#4108685
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108685
17 years, 1 month
[JBossWS] - endPoint and SOAP headers, how to work this?
by camateusno
Hi all, Im have a problem with SOAP headers, because i dont know how see it in endpoint. Explain:
first im consume de webservice, and i see this and more:
a class SEI: QMWISeSoap
a class that provide constructors: ObjectFactory
The server requires two soap headers, these are build by ObjectFactory, and return a object JAXBElement:
/**
* Create an instance of {@link JAXBElement }{@code <}{@link TrustHeader }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://questionmark.com/QMWISe/", name = "Trust")
public JAXBElement createTrust(TrustHeader value) {
return new JAXBElement(_Trust_QNAME, TrustHeader.class, null, value);
}
Now, in a class QMWISeWebService is the call to SEI:
protected QMWISeWebService() {
try {
if (endPoint == null){
endPoint = new QMWISe().getQMWISeSoap();
}
} catch (Exception ex) {
ex.printStackTrace();
}
And by example i have a class that inherit from QMWISeWebService :
public class ParticipantData extends QMWISeWebService {
/**
* This method processes a Participant Name and a Password and checks
* whether there is a participant with the Participant Name, and if so
* whether the Password is theirs.
*
* @param participantID
* @param password
* @param status
* @param participantName
*/
public void checkParticipant(String participantName, String password,
Holder status, Holder participantID) {
endPoint.checkParticipant(participantName, password, status,
participantID);
}
The problem is that i dont know how connect the JAXBElement returned by ObjectFactory with the SEI class.
Part of SEI class is:
@WebService(name = "QMWISeSoap", targetNamespace = "http://questionmark.com/QMWISe/")
public interface QMWISeSoap {
/**
* This method provides information about the QMWISe software that is installed, including the version of the software that is installed, which build of the software is installed and a statement of Question Mark's rights under the license agreement.
*
* @return
* returns com.questionmark.qmwise.Version
*/
@WebMethod(operationName = "GetAbout", action = "http://questionmark.com/QMWISe/GetAbout")
@WebResult(name = "GetAboutResult", targetNamespace = "http://questionmark.com/QMWISe/")
@RequestWrapper(localName = "GetAbout", targetNamespace = "http://questionmark.com/QMWISe/", className = "com.questionmark.qmwise.GetAbout")
@ResponseWrapper(localName = "GetAboutResponse", targetNamespace = "http://questionmark.com/QMWISe/", className = "com.questionmark.qmwise.GetAboutResponse")
public Version getAbout();
And none method of SEI have a parameter that contain data for the SOAP header.
perhaps this is a trivial problem, but im need help. thanks.
What is the mechanism?, the objectFactory provide the JAXBElement, and what to do with that?, What can I do so that the information finally reaches the envelope of soap?, thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108655#4108655
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108655
17 years, 1 month
[JBossWS] - How could see the endpoint the SOAP headers built by a objec
by camateusno
Hi all, Im have a problem with SOAP headers, because i dont know how see it in endpoint. Explain:
first im consume de webservice, and i see this and more:
a class SEI: QMWISeSoap
a class that provide constructors: ObjectFactory
The server requires two soap headers, these are build by ObjectFactory, and return a object JAXBElement:
/**
* Create an instance of {@link JAXBElement }{@code <}{@link TrustHeader }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://questionmark.com/QMWISe/", name = "Trust")
public JAXBElement createTrust(TrustHeader value) {
return new JAXBElement(_Trust_QNAME, TrustHeader.class, null, value);
}
Now, in a class QMWISeWebService is the call to SEI:
protected QMWISeWebService() {
try {
if (endPoint == null){
endPoint = new QMWISe().getQMWISeSoap();
}
} catch (Exception ex) {
ex.printStackTrace();
}
And by example i have a class that inherit from QMWISeWebService :
public class ParticipantData extends QMWISeWebService {
/**
* This method processes a Participant Name and a Password and checks
* whether there is a participant with the Participant Name, and if so
* whether the Password is theirs.
*
* @param participantID
* @param password
* @param status
* @param participantName
*/
public void checkParticipant(String participantName, String password,
Holder status, Holder participantID) {
endPoint.checkParticipant(participantName, password, status,
participantID);
}
The problem is that i dont know how connect the JAXBElement returned by ObjectFactory with the SEI class.
Part of SEI class is:
@WebService(name = "QMWISeSoap", targetNamespace = "http://questionmark.com/QMWISe/")
public interface QMWISeSoap {
/**
* This method provides information about the QMWISe software that is installed, including the version of the software that is installed, which build of the software is installed and a statement of Question Mark's rights under the license agreement.
*
* @return
* returns com.questionmark.qmwise.Version
*/
@WebMethod(operationName = "GetAbout", action = "http://questionmark.com/QMWISe/GetAbout")
@WebResult(name = "GetAboutResult", targetNamespace = "http://questionmark.com/QMWISe/")
@RequestWrapper(localName = "GetAbout", targetNamespace = "http://questionmark.com/QMWISe/", className = "com.questionmark.qmwise.GetAbout")
@ResponseWrapper(localName = "GetAboutResponse", targetNamespace = "http://questionmark.com/QMWISe/", className = "com.questionmark.qmwise.GetAboutResponse")
public Version getAbout();
And none method of SEI have a parameter that contain data for the SOAP header.
perhaps this is a trivial problem, but im need help. thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108591#4108591
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108591
17 years, 1 month