carpiediem 0 Newbie Poster

I'm trying to use a local HTML file as a SOAP client. I'm new to this, but I believe that leaves JavaScript or a normal POST form as options. I've gotten some responses from simple web services using some code from IBM, but I keep getting errors when trying to connect to my company's set up.

There's a few potential issues. One, I'm not sure if I'm handling the password protection correctly. Two, the namespaces are arranged differently than the IBM demo and I'm not sure how to deal with them. Three, my company server has a different port for SOAP-- I'm not sure if this matters.

I've tried getting help from the developer, without much luck, but my request works in SoapUI and I can reach the WDSL file in my browser. Is there any kind of guide as to how a complex request can be rearranged into a HTML form? Thanks!

Endpoint: https://foobarbaz.com:8099/IRISWS/ContainerStatus
Username: baz (different from credentials below...)
Password: qux

Request (user credentials withheld):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:iris="irisws">
  <soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken>
        <wsse:Username>foo</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">bar</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <iris:GetContainerStatus>
       <iris:STC>IRISTEST1</iris:STC>
       <iris:Container>FPBJ1234567</iris:Container>
    </iris:GetContainerStatus>
  </soapenv:Body>
</soapenv:Envelope>

My Javascript attempt:

var callback = function(call,envelope)
{
  // envelope is the response SOAP.Envelope
  // the XML Text of the response is in arguments[2]
  $('soap').innerHTML = arguments[2].escapeHTML();
}

var envelope = new SOAP.Envelope();
var header = envelope.create_header();
var sec = header.create_child(new WS.QName('wsse:Security','http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'));
var utn = sec.create_child(new WS.QName('wsse:UsernameToken'));
//utn.create_child(new WS.QName('wsse:Username')).set_value('foo');
//utn.create_child(new WS.QName('wsse:Password')).set_value('bar');
//Neither set of user credential seem to work...

utn.create_child(new WS.QName('wsse:Username')).set_value('baz');
utn.create_child(new WS.QName('wsse:Password')).set_value('qux');

var body = envelope.create_body();
var gcs = body.create_child(new WS.QName('iris:GetContainerStatus'));
gcs.create_child(new WS.QName('iris:STC')).set_value('IRISTEST1');
gcs.create_child(new WS.QName('iris:Container')).set_value('FPBJ1234567');
var h = (new WS.Call('https://foobarbaz.com:8099/IRISWS/ContainerStatus')).invoke(envelope, callback);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.