The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem consuming document-style webservice

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Nasir Khan

Posts: 1
Nickname: mank
Registered: Jun, 2006

Problem consuming document-style webservice Posted: Jun 13, 2006 7:15 AM
Reply to this message Reply
Advertisement
Hi,

I am trying to consume a third-party document-style webservice using apache axis. I am passing following xml as request

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>
& lt;Get_Paymentech xmlns="https://secure.assist.com/soap/">
<Version>2.0.2</Version> ;
<UserID>admin</UserID>
<Password>admin</Password>
< Records>

<Paymentech>
<PropertiesFile></PropertiesFile>
<Division ></Division>
<Action>AUTH</Action>
<CardNumber>424242 4242424242</CardNumber>
<CIDNumber>1234</CIDNumber>
<Expira tionDate>2005-11</ExpirationDate>
<TotalAmount>100.00</TotalAm ount>
<TaxAmount>5.50</TaxAmount>
</Paymentech>

</Recor ds>
</Get_Paymentech>
</soap:Body>
</soap:Envelope>

And the code for consuming webservice is

String serviceURL = "https://domain/services/XMLService";
if(xmlFileFile.exists()) {
Options opts = new Options(null);
opts.setDefaultURL(serviceURL);
org.apache.axis.client.Service service = new Service();
service.createCall();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress( new URL(opts.getURL()) );
call.setTimeout(new Integer(3000000));
SOAPBodyElement[] input = new SOAPBodyElement[1];
input[0] = buildBodyElement(xmlFile);
logger.debug("input[0]="+input[0]);
Vector elems = (Vector) call.invoke( input );
SOAPBodyElement elem = null ;
Element e = null ;
elem = (SOAPBodyElement) elems.get(0);
e = elem.getAsDOM();
String str = "Res elem[0]=" + XMLUtils.ElementToString(e);
logger.debug("str="+str);
} else {
logger.debug("Not found str");
}

private SOAPBodyElement buildBodyElement(String xmlFilePath) throws Exception{
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true);
DocumentBuilder xmlBuilder = domFactory.newDocumentBuilder();
Document doc = xmlBuilder.parse(xmlFilePath);
if(doc != null)
logger.debug("doc="+doc.getLocalName()+":"+doc.getNamespaceURI()+":"+doc.getNod eValue());
SOAPBodyElement body = new SOAPBodyElement((Element) getRootElement(doc));
logger.debug("body="+body);
return body;
}

public Node getRootElement(Document doc) {
NodeList level1Children = doc.getChildNodes();
logger.debug("level1Children"+level1Children.getLength());
for(int i = 0; i < level1Children.getLength(); i++){
Node currChild = level1Children.item(i);
logger.debug("currChild.getNodeType()"+currChild.getNodeType());
if(currChild.getNodeType() == Node.ELEMENT_NODE){
logger.debug("currChild.getFirstChild()"+currChild.getFirstChild().getNodeName( )+":"+currChild.getFirstChild().getNodeValue());
return currChild;
}
}
return null;
}


The error that I am getting is:

org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
org.apache.ax is.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
org.apache.axis.Message.getSOAP Envelope(Message.java:435)
org.apache.axis.handlers.soap.MustUnderstandChecker.i nvoke(MustUnderstandChecker.java:62)
org.apache.axis.client.AxisClient.invoke(Ax isClient.java:206)
org.apache.axis.client.Call.invokeEngine(Call.java:2784)
org. apache.axis.client.Call.invoke(Call.java:2767)
org.apache.axis.client.Call.invok e(Call.java:1792)


Reponse would be highly appreciated.

Mank

Topic: Applet - Graphing Quadratic Function Help Previous Topic   Next Topic Topic: Replacing the CANVAS with other

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use