I've found out that if I add:
@XmlRootElement
@Entity
public class OriginalBilde implements Serializable {
@XmlElement(name="bilde")
@OneToMany(cascade = CascadeType.ALL, mappedBy="originalbilde", fetch =
FetchType.LAZY)
private List<Bilde> bilder;
..}
And
@Entity
public class Bilde implements Serializable {
@XmlTransient
@ManyToOne
@JoinColumn(name = "originalbilde_id", nullable = false)
private OriginalBilde originalbilde;
}
I can see the public List<Bilde> getAllBilder() from my webService.
But there must be somethong wrong. I get the following errors:
javax.xml.ws.WebServiceException: unexpected XML reader state. expected:
END_ELEMENT but found: START_ELEMENT
at
com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.java:279)
at
com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:536)
at
com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:260)
at
com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:139)
at
com.sun.xml.internal.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:86)
at
com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:174)
at
com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:108)
at $Proxy16.getOriginalBilder(Unknown Source)
kriskross wrote:
>
> Hi.
> Having some trouble with exposing a webservice correct.
> In my ejb OriginalBilde I have:
>
> @OneToMany(mappedBy = "originalbilde", cascade = CascadeType.ALL, fetch =
> FetchType.LAZY)
> private List<Bilde> bilder;
>
> public List<Bilder> getBilder() {
> return this.bilder;
> }
>
> I'm using a session bean to get My Originalbilder and expose them as a Web
> service.
>
> All other methods are avaliable through my webservice. Exept the OnetoMany
> List<Bilder>.
> There is probably a reason for this. So I'd like to know why, and how I
> can expose the method getBilder().
>
> Hope someone can helpe me.
> Best Regards
>
--
View this message in context: http://www.nabble.com/Missing-method-in-WebService-%40OneToMany-tf4368075.html#a12456133
Sent from the java.net - glassfish users mailing list archive at Nabble.com.