Link to home
Start Free TrialLog in
Avatar of kcquestions
kcquestions

asked on

JAX-WS javax.xml.bind.JAXBException in websrvice client (nor any of its super class is known to this context)

Hello Experts,
In RAD8, I've generated(with default settings) jax-ws(2.0 and 2.1) web service client uisng WSDL .
When i try to call using proxy calss I am getting following exception .

Caused by: javax.xml.bind.JAXBException: class com.siebel.xml.Input nor any of its super class is known to this context.

I did googled to find solution, some people are suggesting to change namespace and some people are suggesting to use cutom bindings, i am not clear about this.

I am struggling for this from yesterday, Can anyone help me to resolve this issue ?

Thanks in advance.
Avatar of girionis
girionis
Flag of Greece image

Do you have access to the source code? If yes try to add the XmlSeeAlso annotation:

http://stackoverflow.com/questions/3237473/jaxb-exception-class-not-known-to-this-context
Avatar of kcquestions
kcquestions

ASKER

I've added @XmlSeeAlso in all com.siebel.xml.Input references, but still getting same error. Please let me know if you need more details.
Can you post the bit of code that throws this exception?
Its happend when i called below method in client proxy class.

public SpcImplementationOutput spcImplementation(SpcImplementationInput spcImplementationInput) {
        return _getDescriptor().getProxy().spcWSSpcImplementation(spcWSSpcImplementationInput);
}


Stack trace:Caused by: javax.xml.bind.JAXBException: class com.siebel.xml.SpcWSSpcImplementationInput nor any of its super class is known to this context.
      at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:552)
      at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:459)
      at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:300)
      at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:229)
      at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:86)
      at com.ibm.xml.xlxp2.jaxb.marshal.MarshallerProxy.marshal(MarshallerProxy.java:100)
      at org.apache.axis2.datasource.jaxb.JAXBDSContext$1.run(JAXBDSContext.java:423)
      at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
      at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshalByElement(JAXBDSContext.java:408)
      at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshal(JAXBDSContext.java:374)
      at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:189)
      at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:372)
      at org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:296)
      at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:725)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:966)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:995)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:271)
      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:233)
      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:995)
      at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:484)
      at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
      at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.writeMessage(SOAPOverHTTPSender.java:3298)
      at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.sendChunkedRequest(SOAPOverHTTPSender.java:825)
      at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.sendSOAPRequest(SOAPOverHTTPSender.java:744)
      at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:534)
      at com.ibm.ws.websvcs.transport.http.HTTPTransportSender.invoke(HTTPTransportSender.java:362)
      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
      at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:567)
Can you show me the bit of code that you create the spcWSSpcImplementationInput?
Thanks for troubleshooting this issue.

SpcImplementationInput spcWSSpcImplementationInput = new ObjectFactory().SpcWSSpcImplementationInput();
spcWSSpcImplementationInput.setRequestSystem("abc");

Also tried with new SpcWSSpcImplementationInput();

One thing i was missed to tell you.
I've added(on the top of class definition) @XmlSeeAlso in all com.siebel.xml.SpcImplementationInput references, but still getting same error. I am not sure is this correct or not.
ex:
@XmlSeeAlso(com.siebel.xml.SpcWSSpcImplementationInput.class)
public class ObjectFactory {
@XmlSeeAlso(com.siebel.xml.SpcWSSpcImplementationInput.class)

You will have to add this in your SpcImplementationInput class

@XmlSeeAlso({com.siebel.xml.SpcWSSpcImplementationInput.class})
public class SpcImplementationInput { 

Open in new window


or

@XmlSeeAlso({com.siebel.xml.SpcImplementationInput.class})
public class SpcWSSpcImplementationInput { 

Open in new window


Try this and if this does not help then we can try marshalling and unmarshalling the object using JAXB.
Looks like its not worked.
I know marshalling and unmarshalling using JAXB (using .xsd files). But I am not sure how to do this for webservices (WSDL). Please point me ?
Hi, i am checking for some more options. This time i've generated JAX-WS classes in default packages (now claases are genarated in two packages), now i am getting below error. I didn't get any clue. Please advise ?

javax.xml.ws.soap.SOAPFaultException: Internal Error
      at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1310)
      at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.demarshalFaultResponse(MethodMarshallerUtils.java:1036)
      at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMethodMarshaller.demarshalFaultResponse(DocLitBareMethodMarshaller.java:412)
      at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:473)
      at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:436)
      at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:351)
      at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:159)
      at $Proxy245.spcWSSpcImplementation(Unknown Source)
      at com.siebel.xml.spcImplementationProxy.spcWSSpcImplementation(SpcImplementationProxy.java:96)
      at com.service.ps.impl.PortalServiceWrapperImpl.validateSRNumber(PortalServiceWrapperImpl.java:123)
Can you try the following?

SpcImplementationInput spcWSSpcImplementationInput = new ObjectFactory().SpcWSSpcImplementationInput();
spcWSSpcImplementationInput.setRequestSystem("abc");
String xml = <your jaxb marshaller>.marshall(spcWSSpcImplementationInput);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(new StringReader(xml)));
Element docElement = doc.getDocumentElement();

Open in new window


Then try to pass the docElement to the method.
ASKER CERTIFIED SOLUTION
Avatar of kcquestions
kcquestions

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried some options, above option works fine.