Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

SOAP: What am i doing wrong?

  • 12-05-2015 10:59AM
    #1
    Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭


    heres the soap message i need that works using SOAP UI

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:v1="http://xml.mygod.com/ws/wmv/content_store/v1_0/"&gt;
    <soapenv:Header/>
    <soapenv:Body>
    <v1:AdministrativeCommand>
    <NameSpace>myoldname.com</NameSpace>
    <Operation>QueryNamespacePresence</Operation>
    </v1:AdministrativeCommand>
    </soapenv:Body>
    </soapenv:Envelope>

    Here is my java SAAJ write up of it:

    // SOAP Body for query old SIP Domain
    SOAPBody soapBody = envelope.getBody();
    SOAPElement soapBodyElem = soapBody.addChildElement("AdministrativeCommand", "v1");
    SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("Namespace", "vi");
    soapBodyElem1.addTextNode("myoldname.com");
    SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("Operation", "vi");
    soapBodyElem2.addTextNode("QueryNamespacePresence");

    ANy help be great? Error i get is: A DOMException.NAMESPACE_ERR exception is thrown whenever an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.


Comments

  • Registered Users, Registered Users 2 Posts: 6,272 ✭✭✭Buford T Justice


    Is it because you're closing a header without opening one?


  • Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭Galway K9


    nope,

    i added the following lines and no joy

    MimeHeaders headers = soapMessage.getMimeHeaders();
    headers.addHeader("SOAPAction", serverURI + "v1");


  • Registered Users, Registered Users 2 Posts: 4,850 ✭✭✭cython


    For soapBodyElem1 and soapBodyElem2, are you intending to use "vi" for the second argument, or should that "v1" as per the soapBodyElem instantiation, or maybe blank since you've no prefix in the SOAP UI message?


  • Registered Users, Registered Users 2 Posts: 2,353 ✭✭✭Galway K9


    Guys

    Thanks for the help. I resolved the issue.

    1) v1 is the namespace prefix not vi, thsi wasnt consistent
    2) I needed to add correct namespace envelope.addNamespaceDeclaration("v1", "http://xml.mygod.com/ws/mes/content_store/v1_0/");


Advertisement