on 12-02-2008 3:43 PM
Hi community,
i try to create a document in KM on our Portal System via a WebService from my EJB on my NW CE 7.1
Downloading a document worked already. But now, for creating a document, i have to supply different parameters which seems more difficult because i dont't have an easy setter-Method for the Parameters. Instead the Proxy generated JAXBElements<mytype> for every Property and a setter for every Parameter of the Type JAXBElement<mytype>.
For example my actual ejb-method for uploading a document using km-webservice for repository-framework looks like this:
public FObject putFileData (FObject nFObject, String username, String password)
{
// FObject is my own Object-Definition describing a document
System.err.println("Start putFileData");
FObject tFObject = nFObject;
try
{
URL wsdlLocation = new URL("http://mykmserver:50000/RepositoryFrameworkWS/Config1?wsdl");
RepositoryFrameworkWS rf = new RepositoryFrameworkWS(wsdlLocation, new QName("urn:RepositoryFrameworkWSWsd","RepositoryFrameworkWS"));
// RepositoryFrameworkWS rf = new RepositoryFrameworkWS();
RepositoryFrameworkWSViDocument vi = rf.getConfig1Port_Document();
((BindingProvider)vi).getRequestContext().put(BindingProvider.USERNAME_PROPERTY , username);
((BindingProvider)vi).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY , password);
Content nContent = new Content();
JAXBElement<byte[]> md = new JAXBElement<byte[]>(new QName("urn:com.sap.netweaver.bc.rf.ws.content"),byte[].class,nFObject.getFContent());
nContent.setContent(md);
ContentMetadata nContentMetadata = new ContentMetadata();
nContentMetadata.setLength(nFObject.getFContent().length);
JAXBElement<ContentMetadata> cmd = new JAXBElement<ContentMetadata> (new QName("urn:com.sap.netweaver.bc.rf.ws.content"),ContentMetadata.class, nContentMetadata);
nContent.setMetadata(cmd);
Resource nkmdoc = vi.createDocument(tFObject.getFPid(), tFObject.getFName(), new OrderPosition(), true, new LockDescriptor(), new ArrayOfProperty(), nContent, new FetchGroup());
if (nkmdoc != null)
{
tFObject.setFFlag(FObject.OK);
System.err.println("Return OK");
}
else
{
tFObject.setFFlag(FObject.UNKNOWN);
System.err.println("nkmdoc = Null");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
return tFObject;
}
I'm not sure about the code for setting the parametes content for the Content-Object
JAXBElement<byte[]> md = new JAXBElement<byte[]>(new QName("urn:com.sap.netweaver.bc.rf.ws.content"),byte[].class,nFObject.getFContent());
nContent.setContent(md);
because the generated Content Class supports only a JAXBElement<byte[]> as Parameter in the Setter-Method .setContent
Normally i expected the parameter to be of the type byte[]
Calling the Document creating WS with vi.createDocument results in the following exception
javax.xml.ws.soap.SOAPFaultException: Deserializing fails. Nested message: XML Deserialization Error. XML Parser has thrown exception while parsing input
and i now suggest that my parameter-setting the source for that problems.
any ideas and hints are greatly welcome
regards
Matthias
found a solution for my problems and works fine. see my thread in the km-forum
Edited by: Matthias Hayk on Dec 5, 2008 1:46 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.