Namespace problem: Requested element {http://gaws.mec.com/rta/ws/types}businessDate is not allowed in this position in the sequence.
by Douglas Fraser
hi everyone,
I have JBoss 4.0.5.GA, and am using JBoss WS 1.2.1. I have created a
web service (using wstools - not wscompile etc) and the beans, ear etc
deploy fine. The WSDL generated from wstools looks ok (to me). But
when I try to use a client written in PHP (using the SOAP extension) I
am getting this all the time:
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Requested
element {http://gaws.mec.com/rta/ws/types}businessDate is not allowed in
this position in the sequence. The next element should be businessDate
at
org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:219)
at
org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding$Cursor.startElement(ModelGroupBinding.java:159)
at
org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:277)
at
org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:323)
at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
this is the SOAP Request
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://gaws.mec.com/rta/ws/types">
<SOAP-ENV:Body>
<ns1:notifyStatusChange>
<ns1:businessDate>2007-05-02T12:00:00</ns1:businessDate>
<ns1:community>testing</ns1:community>
<ns1:status>OPEN</ns1:status>
</ns1:notifyStatusChange>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
As you can see, the fields within the notifyStatusChange structure are
given a namespace of ns1. the WSDL is defined as such:
<schema targetNamespace='http://gaws.mec.com/rta/ws/types'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:tns='http://gaws.mec.com/rta/ws/types'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<complexType name='NotifyAccountControl'>
<sequence>
<element name='account' type='int'/>
<element name='accountStatus' nillable='true' type='string'/>
<element name='agentNumber' type='int'/>
<element name='balance' nillable='true' type='decimal'/>
<element name='businessDate' nillable='true' type='dateTime'/>
<element name='community' nillable='true' type='string'/>
<element name='division' nillable='true' type='string'/>
<element name='rejectReason' nillable='true' type='string'/>
<element name='timeZone' nillable='true' type='string'/>
<element name='transactionDate' nillable='true' type='dateTime'/>
<element name='transactionType' nillable='true' type='string'/>
<element name='window' type='int'/>
</sequence>
</complexType>
.... and so on
so .... obviously JBoss does not like the subfields being tagged with a
namespace (as far as I can tell, all my research has been of no help).
But I can't figure out how to get the PHP client to stop tagging the
subfields. I am not an expert on WSDL etc so I am not even sure if the
PHP client should be doing that. Should something in the WSDL change
(as the PHP is working off that as a basis)?
So... is there anything I can do to the Java code to get it to stop
being so sensitive? Is this a valid error?
Or does anyone know what to do in the PHP (I tried using the nusoap
library and that worked even worse...)?
Or do I just have to write a Java based client for testing as
anything-but-java is not up to spec like JBossWS is?
But then the real client (another company using Microsoft .NET) is
probably going to have problems....
Help!
thanks
doug
18 years, 11 months
[JBossWS] - Re: creating new targetnamespace for complex types
by khelenek
Thanks for writing back.
That's actually the first technique I tried which also did not seem to work. Here is an example of a my web service bean:
| @Stateless(name="VerificationWs")
| @WebService(
| name="VerificationWs",
| targetNamespace = VerificationWsBean.DEFAULT_NS)
| @SOAPBinding
| public class VerificationWsBean {
|
| @TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)
| @WebMethod
| @WebResult(targetNamespace=VerificationWsBean.DEFAULT_NS)
| public VerificationResponse verify(
| @WebParam(targetNamespace=VerificationWsBean.DEFAULT_NS) VerificationRequest request
| ) throws Exception {
| return verifyDirect(request);
| }
| }
|
And then in my VerificationRequest.java class I have:
| @XmlType(namespace="http://verification.studentuniverse.com/ws/client")
| public class VerificationRequest implements Serializable {
|
But in my wsdl I still get VerificationRequest mapped as complex types under a schema with the package namespace:
| <schema elementFormDefault="qualified" targetNamespace="http://package.mycompany.com/jaws">
|
(The methods map as complex types under the correct namespace as defined by the @WebService annotation, though.
Any ideas what to try next?
Thanks in advance,
kris
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045596#4045596
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045596
18 years, 11 months
[JBossWS] - If I deploy more than one webservice I get "Multiple context
by rickcr
I can deploy a simple webservice and everything works fine. If II create another webservice in a similar manner and deploy it, I end up with a "Multiple context root not supported" error.
This is very frustrating since I see nothing about this issue in the users guide.
Here was an example of an initial web service I was trying to deploy (which works fine, until I try to deploy another webservice using the same approach):
@Local
@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public interface Echo {
@WebMethod String testEcho(String s);
}
@Stateless
@WebService(endpointInterface="com.foobar.edsf.example.ejb.webservices.Echo")
public class EchoBean {
public String testEcho(String s) {
return s;
}
}
If I deploy a similar webservice like the above, I'll get the Multiple context root not supported error. Am I doing something unorthodox or is this a bug? My EJB3 book and the examples that come with the jboss patch here: http://docs.jboss.org/ejb3/app-server/tutorial/installing.html show examples like I'm doing above.
There is something related to this in jira http://jira.jboss.com/jira/browse/JBWS-1622 but I can't seem to get the concept of @WebContext working correctly (I also don't see why I should even need to use a non-standard JBoss annotation to do something that should be standard.)
WITHOUT adding a @WebContext I'll end up with a wsdl location like:
http://machine-name:8080/EchoBeanService/EchoBean?wsdl
If I try to declare a @WebContext I won't get the multiple context root error, but it changes the wsdl path to a path that it can't find. For example if I give it a path:
@WebContext(contextRoot="/EDSF-tests", secureWSDLAccess=false)
I end up with a wsdl URL:
http://machine-name:8080/EDSF-tests/EchoBean?wsdl
Which doesn't point to the wsdl anymore.
Can someone give me some pointers about what I'm doing wrong? There must be a reason others have not run into this as well since I don't think I'm creating my webservices in a unique way.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045595#4045595
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045595
18 years, 11 months
[JBossWS] - WSSecurity not working
by jopere
I have created web service that uses a POJO endpoint and have successfully connected to it from a servlet. Now I am trying to add WSSecurity to it, using signed certificates. When I run the client, it connects to the web service, but the message is not signed. I verify this by monitoring the soap message, which does not include any of the wsse tags.
I am using:
JBoss 4.0.4.GA with the default JBossWS installed
JDK 1.5.0_07
JWSDP 2.0
Compiling the service using wstools
Compiling the client using wscompile
I Used OpenSSL to created the signed certificates/keystore/truststore
After reading both the JBossWS User Guide and the JAX-WS User Guide as well as many posts to this forum I used the following setup for the web serivice and client.
Web Service: included jboss-wsse-server.xml, standard-jaxrpc-endpoint-config.xml, server.truststore and client.keystore in web-inf, along with normal deployment descriptors.
jboss-wsse-server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
<key-store-file>META-INF/client.keystore</key-store-file>
<key-store-password>webservicec</key-store-password>
<trust-store-file>META-INF/server.truststore</trust-store-file>
<trust-store-password>jbossws</trust-store-password>
</jboss-ws-security>
standard-jaxrpc-endpoint-config.xml:
<jaxws-config xmlns="urn:jboss:jaxws-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
<endpoint-config>
<config-name>Standard WSSecurity Endpoint</config-name>
<pre-handler-chains>
<javaee:handler-chain>
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
<javaee:handler>
<javaee:handler-name>WSSecurity Handler</javaee:handler-name>
<javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</pre-handler-chains>
</endpoint-config>
</jaxws-config>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
.. servlet mappings ...
<context-param>
<param-name>jbossws-config-name</param-name>>
<param-value>Standard Secure Endpoint</param-value>
</context-param>
</web-app>
Client: Included jboss-wsse-client.xml, standard-jaxrpc-client-config.xml, and client.keystore in web-inf, as well as normal deployment descriptorts.
jboss-wsse-client.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
<key-store-file>META-INF/client.keystore</key-store-file>
<key-store-password>jbossws</key-store-password>
</jboss-ws-security>
standard-jaxrpc-client-config.xml:
<jaxrpc-config xmlns="urn:jboss:jaxrpc-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xsi:schemaLocation="urn:jboss:jaxrpc-config:2.0 jaxrpc-config_2_0.xsd">
<client-config>
<config-name>Standard WSSecurity Client</config-name>
<post-handler-chain>
<handler-chain-name>WSSecurity Handlers</handler-chain-name>
<j2ee:handler-name>WSSecurityHandlerOutbound</j2ee:handler-name>
<j2ee:handler-class>org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerOutbound</j2ee:handler-class>
</post-handler-chain>
</client-config>
</jaxrpc-config>
I also included several libs from libraries from the JAXRPC and SAAJ libs in the JWSDP. I did not add any special code to web.wml.
Both the web service and client deploy without error, and when I run the service is runs without error. But when I look at the SOAP message that was sent it is not signed.
Next I tried upgrading to JBossWS 1.2.1. With this configuration both web the service and client install correctly, but when I run the code I get this error:
19:54:23,064 WARN [[WebClient]] Servlet.service() for servlet WebClient threw exception
java.rmi.RemoteException: Couldn't create SOAP message factory due to exception: javax.xml.soap.SOAP
Exception: Unable to create message factory for SOAP: org.jboss.ws.core.soap.MessageFactoryImpl; nes
ted exception is:
Couldn't create SOAP message factory due to exception: javax.xml.soap.SOAPException: Unable
to create message factory for SOAP: org.jboss.ws.core.soap.MessageFactoryImpl
at com.acxiom.mypkg.Purchaser_Stub.purchase(Purchaser_Stub.java:88)
at com.acxiom.webclient.Client.doGet(Client.java:41)
at com.acxiom.webclient.Client.doPost(Client.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
...
Can somebody please help me to see what I am doing wrong?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045319#4045319
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045319
18 years, 11 months