[JBossWS] - JBossWS 2.0 throws WebServiceException: Error creating JAXBC
by Juergen.Zimmermann
I updated my JBoss 4.2 installation to JBossWS 2.0. Only minor modifications where necessary for ANT build.xml files (JARs changed regarding classpath, classes for ANT tasks changed).
However, if I run my JBossWS clients I get this stacktrace. What's going on? Any hint is appreciated! When testing with the generic WS test client of the Eclipse plugin WTP everything works fine.
java.lang.ExceptionInInitializerError
| at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
| at java.lang.Class.newInstance0(Class.java:355)
| at java.lang.Class.newInstance(Class.java:308)
| at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
| at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
| at javax.xml.ws.spi.Provider.provider(Provider.java:76)
| at javax.xml.ws.Service.(Service.java:57)
| at de.hska.wsgen.KundenverwaltungService.(KundenverwaltungService.java:41)
| at de.hska.test.WebServicesJBossWSTest.setupProxy(WebServicesJBossWSTest.java:44)
| Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference.
| at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:188)
| at com.sun.xml.ws.spi.ProviderImpl.(ProviderImpl.java:65)
| Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
| Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.
| this problem is related to the following location:
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
| at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| this problem is related to the following location:
| at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
| at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
| at javax.xml.ws.wsaddressing.W3CEndpointReference
| Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.
| this problem is related to the following location:
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
| at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| this problem is related to the following location:
| at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
| at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
| at javax.xml.ws.wsaddressing.W3CEndpointReference
|
| at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
| at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
| at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:270)
| at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:103)
| at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:81)
| at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
| at javax.xml.bind.ContextFinder.find(ContextFinder.java:366)
| at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
| at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
| at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:186)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062337#4062337
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062337
16 years, 12 months
[JBossWS] - How to return a complex type?
by Ufic
Hi.
I'm a new user of JBoss.
I'm trying to create a WebService with JBoss 4.2.0 and Eclipse 3.1 (using Java 1.5 and Ejb 2.1: I must use these versions).
No problem with business methods returning a String, but I can't create business methods returning an array of Strings, a JavaBean or (it's my really goal) an array of JavaBeans.
I realize that in some way I have to map Java types in xml types and viceversa. But, HOW?
I have to change wsdl file, jaxrpc-mapping.xml, webservices.xml or I have to create some new file?
Googling, I found too many infos: sorry, maybe this is a faq but it's driving me crazy :( .
I can deploy a Service that returns an array of Strings but the client throws the follow exception:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
| Deserializing parameter 'result': could not find deserializer for type
| {http://dipartimento.wsEjb.agaticarnazzo.it/types}String.Array
| at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:308)
| at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1040)
| at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
| at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:856)
| at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:325)
| at org.apache.axis.message.RPCElement.getParams(RPCElement.java:349)
| at org.apache.axis.client.Call.invoke(Call.java:2379)
| at org.apache.axis.client.Call.invoke(Call.java:2278)
| at org.apache.axis.client.Call.invoke(Call.java:1772)
| at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:195)
| at $Proxy0.getDocumenti(Unknown Source)
| at it.agaticarnazzo.dipartimento.wsPojo.TestClient.main(TestClient.java:30)
And if I try to deploy a webservice that returns a JavaBean, Jboss prints the follow error:
Cannot load java type: MyJavaBean.in.its.package
Can someone help me? :(
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062268#4062268
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062268
16 years, 12 months
[JBossWS] - Re: setHeader and setServerURL, using javax.xml.ws.Service?
by eric@attask.com
I think i'm getting a little closer, after reading the JAX-RPC user guild I think I need to set the: Unbound SOAP Headers on the client proxy, see
http://jbws.dyndns.org/mediawiki/index.php?title=JAX-RPC_User_Guide#Unbou...
I've tried this but it didn't seem to work
| URL urlToWSDL = JbossWSConnection.class.getResource("/partner-wsdl.xml");
| QName q = new QName("urn:partner.soap.sforce.com", "SforceService");
| SforceService service = new SforceService(urlToWSDL, q);
| Soap soapBinding = service.getSoap();
| StubExt stub = (StubExt)soapBinding;
| LoginResult lr = soapBinding.login("username", "password");
| SessionHeader session = new SessionHeader();
| session.setSessionId(lr.getSessionId())
| QName headerQ = new QName(service.getServiceName().getNamespaceURI(), "SessionHeader");
| stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_ANYTYPE, SessionHeader.class, ParameterMode.IN);
| stub.setUnboundHeaderValue(headerQ, session);
This is the error that I get:
Caused by: org.jboss.ws.WSException: Cannot obtain serializer factory for: [xmlType={http://www.w3.org/2001/XMLSchema}anyType,javaType=class com.sforce.soap.partner.SessionHeader]
at org.jboss.ws.core.soap.ObjectContent.getSerializerFactory(ObjectContent.java:189)
at org.jboss.ws.core.soap.ObjectContent.marshallObjectContents(ObjectContent.java:139)
at org.jboss.ws.core.soap.ObjectContent.transitionTo(ObjectContent.java:65)
at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:129)
at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentElement.java:536)
at org.jboss.ws.core.soap.SOAPHeaderElementImpl.writeElement(SOAPHeaderElementImpl.java:132)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:825)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:810)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:825)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:810)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPElementWriter.java:149)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWriter.java:130)
at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:288)
at org.jboss.ws.core.soap.SOAPMessageMarshaller.write(SOAPMessageMarshaller.java:76)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:164)
I'm guessing the problem has to do with
stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_ANYTYPE, SessionHeader.class, ParameterMode.IN); any Idea on which QName xmlType I should pick? I'm using the org.jboss.ws.Constants Interface.
I've also tried:
| QName headerQ = new QName(service.getServiceName().getNamespaceURI(), "SessionHeader");
| SessionHeader.class, ParameterMode.IN);
| stub.addUnboundHeader(headerQ, Constants.TYPE_LITERAL_STRING, String.class, ParameterMode.IN);
| stub.setUnboundHeaderValue(headerQ, lr.getSessionId());
|
but then I get the infamous:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:56)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:111)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:460)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:333)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:185)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:163)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:149)
at $Proxy22.query(Unknown Source)
at salesforce.JbossWSConnection.querySample(JbossWSConnection.java:165)
at salesforce.JbossWSConnection.main(JbossWSConnection.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062129#4062129
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062129
16 years, 12 months
[JBossWS] - .NET client calling Java web-service (SOAPFaultException)
by cowsudders
Hi all
We are replacing a set of .NET web-services with a set of Java ones (deployed into JBoss 4.0.5). All is fine with building/deploying/calling the web-services from .NET - however, I'm having some trouble with regards exceptions.
The .NET client code (which we cannot change), has the following code:
| try {
| doWebServiceCall()
| }
| catch(SoapException se)
| {
| MessageBox.Show("Soap Exception Received! " + se.Message);
| outXmlBrowser.Navigate( WriteToTempFile(se.Detail.InnerXml), ref n_pointer, ref n_pointer, ref n_pointer, ref n_pointer);
| }
The problem is highlighted in bold - I cannot seem to fill the Detail object being returned in the SOAPFaultException I throw in the web-service code. I'm throwing a simple SOAPFaultException as follows:
| try {
| String strXML = MyObject.getXML();
| Detail faultDetail = SOAPFactory.newInstance().createDetail();
| faultDetail.addChildElement("SoapErrorDetail").addChildElement(strXML);
| }
| catch(Exception e) {
| logit(e);
| }
|
The following snippet shows the JBoss log file after the above code executes:
| 2007-07-09 17:46:07,709 DEBUG [javax.xml.rpc.soap.SOAPFaultException] new SOAPFaultException [code={http://schemas.xmlsoap.org/soap/envelope/}Client,string=<?xml version="1.0" encoding="ISO-8859-1"?>
| <SoapErrorDetail xmlns="my.name.space.here" ResultCode="11400" ResultID="InternalError" ResultMessage="Internal error occured "/>
| ,actor=null,detail=null]
|
As can be seen in bold, the Detail object is null....
I have a few questions:
i) How can I create the SOAPFaultException so that the Detail object is not null when it is pushed out of JBoss?
ii) As seen above, I am pushing an XML string into the Detail object. However, I also have this XML document as an org.w3c.dom.Element object. Therefore, it is possible to push the XML document in this form into the Detail object in order to stop it being null? If so, how do I convert an org.w3c.dom.Element object into javax.xml.soap.SOAPElement object in order to add it to the Detail object set within the SOAPFaultException object.
Is it possible to return a Detail object from JBoss?
Thanks in advance for all your help,
Thanks
Kind regards
Dave
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062081#4062081
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062081
16 years, 12 months
[JBossWS] - Re: setHeader and setServerURL, using javax.xml.ws.Service?
by eric@attask.com
That seems to reset the URL:
SforceService service = new SforceService(urlToWSDL, q);
| Soap soapBinding = service.getSoap();
| LoginResult lr = soapBinding.login("username", password");
| ((BindingProvider)soapBinding).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, lr.getServerUrl());
|
That works perfectly, with JBoss 1.2.1 sp1
I still haven't figured out how to set the sessionID. I've tried:
SessionHeader session = new SessionHeader();
| session.setSessionId(lr.getSessionId());
| ((BindingProvider)soapBinding).getRequestContext().put("SessionHeader", session);
|
but I still get the following error:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:56)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:111)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:460)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:333)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:185)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:163)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:149)
at $Proxy22.query(Unknown Source)
THIS IS HOW YOU SET THE SESSION HEADER IN AXIS:
SoapBindingStub service; // public class SoapBindingStub extends org.apache.axis.client.Stub implements com.sforce.soap.partner.Soap
SessionHeader sessionHeader = new SessionHeader();
| sessionHeader.setSessionId(sessionID);
|
| String sforceURI = new SforceServiceLocator().getServiceName().getNamespaceURI();
| service.setHeader(sforceURI, "SessionHeader", sessionHeader);
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062080#4062080
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062080
16 years, 12 months