Hi everybody!

I'm trying to build some XML document and send it on the fly to a
webservice. I've managed to do this with a file using the parse method
from javax.xml.parsers, But now I'm tryning to do it building my own XML
doc.

If I print the document I built everything looks ok, but when I invoke
the service I get:

xisFault
 faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Couldn't find an appropriate operation for XML QName
{http://adaptor}itemcount
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}hostname:kheijo.dracus.homeip.net

Couldn't find an appropriate operation for XML QName
{http://adaptor}itemcount
        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
...........


This is the code I'm using to build the XML ands send it. I just can't
figure waht is wrong...

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document db = dbf.newDocumentBuilder();
Document document = db.newDocument();
Element docRoot=document.createElement("itemcount");
document.appendChild(docRoot);
Element itemElem = document.createElement("item");
itemElem.setAttribute("userid",userId);
itemElem.setAttribute("itemid",itemId);
docRoot.appendChild(document.createTextNode("\n"));
docRoot.appendChild(itemElem);
docRoot.appendChild(document.createTextNode("\n"));

Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(localUrl+webServiceURL));
call.setOperationName(new QName("incrementUserItemCount"));
SOAPBodyElement[] soapInput = new SOAPBodyElement[1];
soapInput[0] = new SOAPBodyElement(document.getDocumentElement());
System.out.println(document.getDocumentElement());
System.out.println(soapInput[0]);
call.invoke(soapInput);


The simple XML doc I'm sending looks like this:
<itemcount>
<item itemid="geral" userid=""/>
</itemcount>

Thanks in advance!
Pedro Silva



Reply via email to