I am trying to set up a web service to Celltrust's SMS Gateway. I have their SDK and I'm trying to use soap4r to create the custom headers that it needs. I'm not sure exactly what I need to do to get it in their format, since they don't provide me with an actual XML document showing what they need; all they say is that in the header you need to give a Username and Password.
Given the following PHP example code, how would I do this in Ruby?
$URN = "urn:notify.soap.primemessage.com";
$WSDL="http://pmgateway.net/pmws/services/TxTMessageService?wsdl";
//SOAP elements (don’t edit, and case sensitive!)
$CTUSERNAME = "Username";
$CTPASSWORD = "Password";
$CTNICKNAME = "nickname";
$DESTINATION = "destination";
$MESSAGE = "message";
$USER_ID = "USERNAME"; //your username at CellTrust
$NICKNAME = "NICKNAME"; //your nickname at Celltrust
$PASSWORD = "PASSWORD"; //your password at Celltrust
//create user and password SOAP header elements
$UserHdr = new SoapHeader( $URN, $CTUSERNAME, $USER_ID, false);
$PassHdr = new SoapHeader( $URN, $CTPASSWORD, $PASSWORD, false);
// call the method here
I've created a derivative class of SOAP::Header::SimpleHandler. What I'm not sure of is whether I need to specify the namespace twice (once for Username, once for Password) or how it is being generated. The documentation doesn't give any name for the namespace and I'm not sure how to do the call to "new SoapHeader" in Ruby properly.
Can anyone help me with this?
You need to create a subclass of SOAP::Header::SimpleHandler, as you mention:
Then just do: