Hi

 

I get an exception when I tried to use a class which is of type of enum.

The exception is something like this 

 

[java] ---------------Jobs Information----------------------

[java] Exception in thread "main"
org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested exception is org.codehaus.xfire.fault.XFireFault: Could not
marshall type.

[java] org.codehaus.xfire.fault.XFireFault: Could not marshall type.

[java]     at
org.codehaus.xfire.jaxb2.JaxbType.writeObject(JaxbType.java:258)

[java]     at
org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindin
gProvider.java:222)

[java]     at
org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(Abstra
ctBinding.java:273)

[java]     at
org.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBi
nding.java:89)

[java]     at
org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:
80)

[java]     at
org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(Ht
tpChannel.java:56)

[java]     at
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.getByteArrayR
equestEntity(CommonsHttpMessageSender.java:388)

[java]     at
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsH
ttpMessageSender.java:326)

[java]     at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.
java:123)

[java]     at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)

[java]     at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
:26)

[java]     at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)

[java]     at
org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)

[java]     at org.codehaus.xfire.client.Client.invoke(Client.java:335)

[java]     at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)

[java]     at
org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)

[java]     at $Proxy26.enumRelationships(Unknown Source)

[java]     at TestBpma.main(TestBpma.java:171)

[java] Caused by: javax.xml.bind.MarshalException

[java]  - with linked exception:

[java] [javax.xml.bind.JAXBException: com.h.b.datatypes.RelationshipType
is not known to this context]

[java]     at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:304
)

[java]     at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:1
48)

[java]     at
org.codehaus.xfire.jaxb2.JaxbType.writeObject(JaxbType.java:253)

[java]     ... 17 more

[java] Caused by: javax.xml.bind.JAXBException:
com.h.b.datatypes.RelationshipType is not known to this context

[java]     at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java
:224)

[java]     at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java
:239)

[java]     at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementB
eanInfoImpl.java:107)

[java]     at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementB
eanInfoImpl.java:149)

[java]     at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBea
nInfoImpl.java:269)

[java]     at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBea
nInfoImpl.java:276)

[java]     at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBea
nInfoImpl.java:35)

[java]     at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java
:472)

[java]     at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:301
)

[java]     ... 19 more

[java] Caused by: javax.xml.bind.JAXBException:
com.h.b.datatypes.RelationshipType is not known to this context

[java]     at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.
java:571)

[java]     at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementB
eanInfoImpl.java:104)

[java]     ... 25 more

 

 

 

 

I checked the ObjectFactory.java class inside the package
com.h.b.datatypes and found that it doesn't have
createRelationshipType() method.

When I added that manually I am able to get past this error.

Btw, RelationshipType.java looks like this.

public enum RelationshipType{

A,

B,

C;

public String value() {

        return name();

    }

 

    public static RelationshipType fromValue(String v) {

        return valueOf(v);

    }

}

 

 

Thanks

Surjit



“This email and any files transmitted with it contain confidential, 
proprietary, privileged information of Symphony Services Corp (India) Pvt. Ltd. 
and are intended solely for the use of the recipient/s to whom it is addressed. 
Any unauthorized notifying, copying or distributing of this e-mail, directly or 
indirectly, and the contents therein in full or part is prohibited by any 
entity who is not a recipient. Any email received inadvertently or by mistake 
should be deleted by the entity who is not a recipient thereof. You may be 
pleased to notify the sender immediately by email and the email should be 
deleted from your system”.

 

Reply via email to