Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your provider is wrong, the messages are semantically equivalent; yours is unqualified, theirs is qualified. Are you using Axis or Axis2? If you're using Axis, I suggest you switch to Axis2 for a more robust, standards-compliant SOAP stack (both products are bad, but Axis2 is less-bad). </p> <p>I assume you are creating your client with wsdl2java? If you can't get this tool to generate the message the way you like, then your best bet is to generate the message programmatically. With Axis2, you can do this with the AXIOM API. See <a href="http://axis.apache.org/axis2/java/core/docs/quickstartguide.html#clientaxiom" rel="noreferrer">this link</a> for some example API usage. Note that with most of the methods, e.g. <a href="http://ws.apache.org/axiom/apidocs/org/apache/axiom/om/OMFactory.html#createOMElement%28org.apache.axiom.om.OMDataSource,%20javax.xml.namespace.QName%29" rel="noreferrer">createOMElement</a>, you optionally pass the namespace prefix. So, if your provider requires it, then you could pass a String containing "imk" as the namespacePrefix parameter.</p> <hr> <p>If you end up doing this programmatically and you are only going to be writing a simple client, then I <strong>STRONGLY</strong> suggest you abandon the Axis/Axis2 approach and use the <a href="http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/" rel="noreferrer">JAX-WS</a> stack instead, as it is part of Java since 1.6. The API is cleaner and the documentation is better. For example, following is a very simple client I wrote to send a SOAP request to our JIRA server. The sample code creates both qualified and unqualified elements.</p> <pre><code>QName port = new QName(endpoint, "subversionsoapservice-v2"); QName serviceName = new QName(endpoint, "ISubversionSoapServiceService"); Service service = Service.create(serviceName); service.addPort(port, SOAPBinding.SOAP11HTTP_BINDING, endpoint); Dispatch&lt;SOAPMessage&gt; dispatch = service.createDispatch(port, SOAPMessage.class, Service.Mode.MESSAGE); MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); SOAPMessage request = factory.createMessage(); SOAPBody body = request.getSOAPBody(); SOAPElement reindexRepository = body.addChildElement("reindexRepository", "jira", "http://soap.ext.plugin.jira.atlassian.com"); SOAPElement in0 = reindexRepository.addChildElement("in0"); in0.addTextNode("test"); request.saveChanges(); dispatch.invoke(request); </code></pre> <p>The XML sent by the client looks like this:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;SOAP-ENV:Body&gt; &lt;jira:reindexRepository xmlns:jira="http://soap.ext.plugin.jira.atlassian.com"&gt; &lt;in0&gt;test&lt;/in0&gt; &lt;/jira:reindexRepository&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; </code></pre>
 

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