Note that there are some explanatory texts on larger screens.

plurals
  1. POSOAP Webservice Client in Java
    primarykey
    data
    text
    <p>I am newbie in SOAP webservice client and getting errors while creating client.</p> <p>please help me to solve this</p> <pre><code>//This is request that has to be send using SOAP Envelope POST /DISWebService/DISWebService.asmx HTTP/1.1 Host: 192.168.2.119 Content-Type: application/soap+xml; charset=utf-8 Content-Length: length &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soap12:Body&gt; &lt;LoginSystem xmlns="http://tempuri.org/"&gt; &lt;username&gt;string&lt;/username&gt; &lt;password&gt;string&lt;/password&gt; &lt;/LoginSystem&gt; &lt;/soap12:Body&gt; &lt;/soap12:Envelope&gt; </code></pre> <hr> <h1>Java Code</h1> <pre><code>public static void main(String args[]) { try { // Create SOAP Connection SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory .newInstance(); SOAPConnection soapConnection = soapConnectionFactory .createConnection(); String url = "http://192.168.2.119/VISWebService/VISWebService.asmx"; // String url = // "http://192.168.2.119/DISWebService/DISWebService.asmx?op=LoginSystem"; SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(),url); // Process the SOAP Response printSOAPResponse(soapResponse); soapConnection.close(); } catch (Exception e) { System.err .println("Error occurred while sending SOAP Request to Server"); e.printStackTrace(); } } private static SOAPMessage createSOAPRequest() throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = "http://192.168.2.119/DISWebService/DISWebService.asmx"; // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); // SOAP Body SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("LoginSystem"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("username"); soapBodyElem1.addTextNode("Chirendu"); SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("password"); soapBodyElem2.addTextNode("verve12*"); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", serverURI ); soapMessage.saveChanges(); /* Print the request message */ System.out.print("Request SOAP Message = "); soapMessage.writeTo(System.out); System.out.println(); return soapMessage; } </code></pre> <p>Please help me to create client.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload