Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

SOAP: What am i doing wrong?

Options
  • 12-05-2015 11:59am
    #1
    Registered Users 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 Posts: 6,252 ✭✭✭Buford T Justice


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


  • Registered Users 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 Posts: 4,766 ✭✭✭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 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