Http body empty when adding customer via prestashop webservice - web-services

I'm trying to add a new customer via webservice to my prestashop database but in appearance, everything is OK, returned code 200 but response xml body is empty and database has no new customers.
I've enabled webservice for the GET and PUT crud methods and generate API Key.
Code for the customer addition is the next one:
require_once('../../../lib/PSWebServiceLibrary.php');
$id_customer = 0;
$id_address = 0;
$id_cart = 0;
$date_now = date("Y-m-d H:i:s");
try {
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
foreach ($pedidos->orders as $ord) {
if (!$id_customer) {
// Getting the empty XML document to send back completed
$xml = $webService->get(array('url' => PS_SHOP_PATH . 'api/customers?schema=blank'));
// Adding dinamic values
// Required
$xml->customer->passwd = Tools::encrypt($password = 'mypassword');
$xml->customer->lastname = $ord->customer->lastname;
$xml->customer->firstname = $ord->customer->firstname;
$xml->customer->email = $ord->customer->customer_id.'#example.com';
// Others
$xml->customer->id_lang = 1;//$id_lang;
$xml->customer->id_shop = 1;
$xml->customer->id_shop_group = 1;
$xml->customer->id_default_group = 3;//$id_group; // Customers
$xml->customer->active = 1;
$xml->customer->newsletter = 0;
$xml->customer->newsletter_date_add = $date_now;
$xml->customer->last_passwd_gen = $date_now;
$xml->customer->date_add = $date_now;
$xml->customer->date_upd = $date_now;
$xml->customer->id_gender = 0;
$xml->customer->associations->groups->group[0]->id = 3; // customers
// Adding the new customer
$opt = array('resource' => 'customers');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);
$id_customer = $xml->customer->id;
}
}
}catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) echo 'Bad ID';
else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
else echo 'Other error<br />'.$e->getMessage();
}
When executed, this one returns a code 200 but the response body is completely empty.
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<customer>
<id></id>
<id_default_group></id_default_group>
<id_lang></id_lang>
<newsletter_date_add></newsletter_date_add>
<ip_registration_newsletter></ip_registration_newsletter>
<last_passwd_gen></last_passwd_gen>
<secure_key></secure_key>
<deleted></deleted>
<passwd></passwd>
<lastname></lastname>
<firstname></firstname>
<email></email>
<id_gender></id_gender>
<birthday></birthday>
<newsletter></newsletter>
<optin></optin>
<website></website>
<company></company>
<siret></siret>
<ape></ape>
<outstanding_allow_amount></outstanding_allow_amount>
<show_public_prices></show_public_prices>
<id_risk></id_risk>
<max_payment_days></max_payment_days>
<active></active>
<note></note>
<is_guest></is_guest>
<id_shop></id_shop>
<id_shop_group></id_shop_group>
<date_add></date_add>
<date_upd></date_upd>
<associations>
<groups>
<group>
<id></id>
</group>
</groups>
</associations>
</customer>
</prestashop>
Anyone knows why is this happening? Thanks for your time.

Asked myself. In my case explained on top, I need one webservice per order so:
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
This line must be inside foreach iteraction.

Related

How to send an element multiple times in the same request in SoapUI using groovy

Can someone help with soap ui mock service? I want to send one part of my request n times.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://www.testSoap.com/InvoiceService/">
<soapenv:Header/>
<soapenv:Body>
<inv:addInvoice>
<invoice>
<fkId>2</fkId>
<dateTime>08/02/2023</dateTime>
<status>none</status>
<!--1 or more repetitions:-->
<invoiceData>
<id>1</id>
<MPK>test</MPK>
<RK>test</RK>
<value>500</value>
</invoiceData>
<payments>
<pid>2</pid>
<type>xd</type>
<valueTotal>3000</valueTotal>
</payments>
</invoice>
</inv:addInvoice>
</soapenv:Body>
</soapenv:Envelope>
How can I add the invoiceData element 3 times? Do I change something in eclipse to do that?
def holder = new com.eviware.soapui.support.XmlHolder(mockRequest.requestContent )
// get arguments
def fkId = Integer.parseInt( holder["//fkId"] )
def dateTime = holder["//dateTime"]
def status = holder["//status"]
def id = Integer.parseInt(holder["//id"])
def MPK = holder["//MPK"]
def RK = holder["//RK"]
def value = Float.parseFloat(holder["//value"])
def pid = Integer.parseInt( holder["//pid"] )
def type = holder["//type"]
def valueTotal = Float.parseFloat(holder["//valueTotal"])
context.operationLogs += fkId
context.operationLogs1 += dateTime
context.operationLogs2 += status
context.operationLogs3 += id
context.operationLogs4 += MPK
context.operationLogs5 += RK
context.operationLogs6 += value
context.operationLogs7 += pid
context.operationLogs8 += type
context.operationLogs9 += valueTotal
requestContext.result1 = fkId
requestContext.result2 = dateTime
requestContext.result3 = status
requestContext.result4 = id
requestContext.result5 = MPK
requestContext.result6 = RK
requestContext.result7 = value
requestContext.result8 = pid
requestContext.result9 = type
requestContext.result10 = valueTotal
requestContext.result = [fkId, dateTime,status,id,MPK,RK,value,pid,valueTotal ]
context.fkId = context.operationLogs.size
context.fkId = context.operationLogs1.size
context.fkId = context.operationLogs2.size
context.fkId = context.operationLogs3.size
context.fkId = context.operationLogs4.size
context.fkId = context.operationLogs5.size
context.fkId = context.operationLogs6.size
context.fkId = context.operationLogs7.size
context.fkId = context.operationLogs8.size
context.fkId = context.operationLogs9.size
How i can send multiple tiem this part request
<!--1 or more repetitions:-->
<invoiceData>
<id>1</id>
<MPK>test</MPK>
<RK>test</RK>
<value>500</value>
</invoiceData>
i have one or more repatitons by i always send only one time
The results should be something like this using
SupplierData elements, but when I try to add the invoiceData element using my Form 3 times I only get 1 invoiceData element and the 2nd and 3rd elements are missing.

500 Internal Server Error error in Webservice request

I have an existing jar which sends web-service request from one of our application server to another. Below is the code for sending the request
public IUsbMessage executeOutboundRequest(IUsbMessage paramIUsbMessage)
{
IUsbMessage localIUsbMessage = UsbMessageFactory.createUbusMessage();
try
{
LogManager.logDebug("ServiceProvider:- Enter executeOutboundRequest");
Object[] arrayOfObject = (Object[])paramIUsbMessage.getPayload();
NVPVO localNVPVO = (NVPVO)arrayOfObject[1];
String str1 = (String)localNVPVO.getHashmap().get("endPointUrl");
String str2 = (String)localNVPVO.getHashmap().get("respTag");
String str3 = (String)localNVPVO.getHashmap().get("body");
str3 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><FIXML xsi:schemaLocation=\"http://www.oracle.com/fixml AcctInq.xsd\" xmlns=\"http://www.oracle.com/fixml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + str3.trim();
LogManager.logDebug("ServiceProvider:- RequestXMLMsg" + str3);
MessageFactory localMessageFactory = MessageFactory.newInstance();
SOAPMessage localSOAPMessage1 = localMessageFactory.createMessage();
SOAPFactory localSOAPFactory = SOAPFactory.newInstance();
SOAPBody localSOAPBody = localSOAPMessage1.getSOAPBody();
SOAPElement localSOAPElement1 = localSOAPBody.addChildElement(localSOAPFactory.createName("executeService"));
SOAPElement localSOAPElement2 = localSOAPElement1.addChildElement(localSOAPFactory.createName("arg_0_0"));
localSOAPElement2.addTextNode(str3);
localSOAPMessage1.saveChanges();
localSOAPMessage1.writeTo(System.out);
SOAPConnectionFactory localSOAPConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection localSOAPConnection = localSOAPConnectionFactory.createConnection();
LogManager.logDebug("ServiceProvider:- endPointUrl" + str1);
LogManager.logDebug("ServiceProvider:- respTag" + str2);
URL localURL = new URL(str1);
SOAPMessage localSOAPMessage2 = localSOAPConnection.call(localSOAPMessage1, localURL);
DocumentBuilderFactory localDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder localDocumentBuilder = localDocumentBuilderFactory.newDocumentBuilder();
Document localDocument = localDocumentBuilder.newDocument();
Element localElement1 = null;
Element localElement2 = null;
Text localText = null;
Element localElement3 = null;
Iterator localIterator = localSOAPMessage2.getSOAPBody().getChildElements();
Object localObject2;
Object localObject3;
while (localIterator.hasNext())
{
localObject1 = (SOAPElement)localIterator.next();
localElement1 = localDocument.createElement(((SOAPElement)localObject1).getNodeName());
localObject2 = ((SOAPElement)localObject1).getAttributes();
Object localObject4;
if (((NamedNodeMap)localObject2).getLength() > 0) {
for (int i = 0; i < ((NamedNodeMap)localObject2).getLength(); i++)
{
localObject4 = ((NamedNodeMap)localObject2).item(i);
localElement1.setAttribute(((Node)localObject4).getNodeName(), ((Node)localObject4).getNodeValue());
}
}
localElement3 = localElement1;
localObject3 = ((SOAPElement)localObject1).getChildElements();
while (((Iterator)localObject3).hasNext())
{
localObject4 = (SOAPElement)((Iterator)localObject3).next();
localElement1 = localDocument.createElement(((SOAPElement)localObject4).getNodeName());
NamedNodeMap localNamedNodeMap = ((SOAPElement)localObject1).getAttributes();
if (localNamedNodeMap.getLength() > 0) {
for (int j = 0; j < localNamedNodeMap.getLength(); j++)
{
Node localNode = localNamedNodeMap.item(j);
localElement1.setAttribute(localNode.getNodeName(), localNode.getNodeValue());
}
}
localElement2 = localElement1;
localText = localDocument.createTextNode(((SOAPElement)localObject4).getValue());
localElement2.appendChild(localText);
localElement3.appendChild(localElement2);
}
The data which is being passed to the class file is as below containing the request XML and other details
respTag=AcctInqRs,
body=<Header>
<RequestHeader>
<MessageKey>
<RequestUUID>Req_159538426</RequestUUID>
<ServiceRequestId>AcctInq</ServiceRequestId>
<ServiceRequestVersion>10.2</ServiceRequestVersion>
<ChannelId>OR</ChannelId>
<LanguageId></LanguageId>
</MessageKey>
<RequestMessageInfo>
<BankId>54</BankId>
<TimeZone></TimeZone>
<EntityId></EntityId>
<EntityType></EntityType>
<ArmCorrelationId></ArmCorrelationId>
<MessageDateTime>2020-02-23T14:27:22.627</MessageDateTime>
</RequestMessageInfo>
<Security>
<Token>
<PasswordToken>
<UserId></UserId>
<Password></Password>
</PasswordToken>
</Token>
<FICertToken></FICertToken>
<RealUserLoginSessionId></RealUserLoginSessionId>
<RealUser></RealUser>
<RealUserPwd></RealUserPwd>
<SSOTransferToken></SSOTransferToken>
</Security>
</RequestHeader>
</Header>
<Body>
<AcctInqRequest>
<AcctInqRq>
<AcctId>
<AcctId>1101614</AcctId>
</AcctId>
</AcctInqRq>
</AcctInqRequest>
</Body>
</FIXML>,
reqhdr.requestuuid=FINCORE240716215711,
endPointUrl=https://ORPREPROD.domain.com:20322/fiwebservice/FIWebService,
reqhdr.messagedatetime=2020-04-21T21:57:11.000,
reqhdr.servicerequestversion=10.2,
reqhdr.origchannelid=COR,
reqhdr.bankid=54,
reqhdr.servicerequestid=AcctInq
Now the issue is that the request is being sent from server A to server B. Once the request reaches server B it is throwing error "HTTP/1.1 500 Internal Server Error" and the below xml is seen in the logs
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>**Failed to get operation name from incoming request**</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
On both the servers our application is deployed on Weblogic and the above errors are from weblogic logs. Can anyone please help me to determine the exact cause of this error, I am totally stuck and clueless about what to do.
The same request XML when sent through SOAP UI works perfectly.
The below request XML works in SOAPUI
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice.fiusb.ci.ibm.com/">
<soapenv:Header/>
<soapenv:Body>
<web:executeService>
<arg_0_0><![CDATA[<FIXML xsi:schemaLocation="http://www.finacle.com/fixml AcctInq.xsd" xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Header><RequestHeader><MessageKey><RequestUUID>Req_158495384262711</RequestUUID><ServiceRequestId>AcctInq</ServiceRequestId><ServiceRequestVersion>10.2</ServiceRequestVersion><ChannelId>COR</ChannelId><LanguageId></LanguageId></MessageKey><RequestMessageInfo><BankId>54</BankId><TimeZone></TimeZone><EntityId></EntityId><EntityType></EntityType><ArmCorrelationId></ArmCorrelationId><MessageDateTime>2020-02-23T14:27:22.627</MessageDateTime></RequestMessageInfo><Security><Token><PasswordToken><UserId></UserId><Password></Password></PasswordToken></Token><FICertToken></FICertToken><RealUserLoginSessionId></RealUserLoginSessionId><RealUser></RealUser><RealUserPwd></RealUserPwd><SSOTransferToken></SSOTransferToken></Security></RequestHeader></Header><Body><AcctInqRequest><AcctInqRq><AcctId><AcctId>1100161916154</AcctId></AcctId></AcctInqRq></AcctInqRequest></Body></FIXML>
]]></arg_0_0>
</web:executeService>
</soapenv:Body>
</soapenv:Envelope>
The below XML throws the same error "Failed to get operation name from incoming request"
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice.fiusb.ci.ibm.com">
<soapenv:Header/>
<soapenv:Body>
<web:executeService>
<arg_0_0><![CDATA[<FIXML xsi:schemaLocation="http://www.finacle.com/fixml AcctInq.xsd" xmlns="http://www.finacle.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Header><RequestHeader><MessageKey><RequestUUID>Req_158495384262711</RequestUUID><ServiceRequestId>AcctInq</ServiceRequestId><ServiceRequestVersion>10.2</ServiceRequestVersion><ChannelId>COR</ChannelId><LanguageId></LanguageId></MessageKey><RequestMessageInfo><BankId>54</BankId><TimeZone></TimeZone><EntityId></EntityId><EntityType></EntityType><ArmCorrelationId></ArmCorrelationId><MessageDateTime>2020-02-23T14:27:22.627</MessageDateTime></RequestMessageInfo><Security><Token><PasswordToken><UserId></UserId><Password></Password></PasswordToken></Token><FICertToken></FICertToken><RealUserLoginSessionId></RealUserLoginSessionId><RealUser></RealUser><RealUserPwd></RealUserPwd><SSOTransferToken></SSOTransferToken></Security></RequestHeader></Header><Body><AcctInqRequest><AcctInqRq><AcctId><AcctId>1100161916154</AcctId></AcctId></AcctInqRq></AcctInqRequest></Body></FIXML>
]]></arg_0_0>
</web:executeService>
</soapenv:Body>
</soapenv:Envelope>
Notice the forward slash(/) at the end of namespace. If the slash is not there in the namespace it throws the error in SOAP UI.
Please help me to understand how can I change namespace in my java code

PHP DomXPath - "object value omitted" even if new DomDocument is not empty?

I have a xml file like this...
XML File
<?xml version="1.0" encoding="UTF-8"?>
<database xmlns="tt:foo" xmlns:h4a="https://www.myexample.com/foo.xsd" >
<tables>
<table name="my_first_table_name">
<column name="column_name_1" />
</table>
</tables>
</database>
I 'm trying to use DOMXPath for a future xml merging.
PHP Code
$doc_ref = new \DOMDocument();
$doc_ref->load( $array_xml_paths[0] );
$xpath_ref = new \DOMXPath($doc_ref);
error_log_array( $xpath_ref );
foreach ($xpath_ref->evaluate('//table[#name]') as $table) {
$table_name = $table->getAttribute('name');
error_log( $table_name );
}
output
[08-Mar-2018 14:21:47 UTC] DOMXPath Object
(
[document] => (object value omitted)
)
The DOMDocument is correclty loaded, but something more seems to be necessary for DOMXPath to work it but I don't know.
First of all...
[document] => (object value omitted) DOES NOT MEAN the DOMXPath instance is empty !
I found the solution. It was in this comment.
I had to register the xml namespace to use evaluate().
Solution
$doc_ref = new \DOMDocument();
$doc_ref->load( $array_xml_paths[0] );
$xpath_ref = new \DOMXPath( $doc_ref );
$ns = $doc_ref->documentElement->namespaceURI;
if($ns) {
$xpath_ref->registerNamespace("ns", $ns);
foreach ($xpath_ref->evaluate('//ns:table[#name]') as $table) {
$table_name = $table->getAttribute('name');
error_log( $table_name );
}
}else {
foreach ($xpath_ref->evaluate('//table[#name]') as $table) {
$table_name = $table->getAttribute('name');
error_log( $table_name );
}
}

saaj exception - Unable to parse content type: null

I'm fairly new to webservices and working through a SAAJ example of sending and recieving attachments (binary files). I can get it to work when the client sends the file but not when it requests it. I get an exception on the client side:
ERROR: 'Content is not allowed in prolog.'
24-Oct-2012 13:59:28 com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source
Anybody have any ideas???my client code is as follows:
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection con = scf.createConnection();
SOAPFactory soapFactory = SOAPFactory.newInstance();
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPHeader header = msg.getSOAPHeader();
header.detachNode();
SOAPBody body = msg.getSOAPBody();
Name bodyName = soapFactory.createName(
"remoteOpen", "remoteOpen",
"http://schemas.remoteOpen.com/remoteOpen");
SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
SOAPElement projectName = bodyElement.addChildElement("projectName");
projectName.addTextNode("filename");
msg.saveChanges();
// create the endpoint and send the message
URL endpoint = new URL("http://localhost:8080/RemoteSaveProject/OpenServlet");
SOAPMessage response = con.call(msg, endpoint);
con.close();
SOAPBody responseBody = response.getSOAPBody();
SOAPElement ackElem = (SOAPElement)responseBody.getFirstChild();
String acknowledgement = ackElem.getValue();
the server code looks like this:
MimeHeaders mimeHeaders = new MimeHeaders();
Enumeration en = request.getHeaderNames();
while (en.hasMoreElements())
{
String headerName = (String)en.nextElement();
String headerVal = request.getHeader(headerName);
StringTokenizer tk = new StringTokenizer(headerVal, ",");
while (tk.hasMoreTokens()){
mimeHeaders.addHeader(headerName, tk.nextToken().trim());
}
}
SOAPMessage message = mf.createMessage(mimeHeaders, request.getInputStream());
SOAPBody body = message.getSOAPBody();
Name bodyName = soapFactory.createName(
"remoteOpen", "remoteOpen",
"http://schemas.remoteOpen.com/remoteOpen");
Iterator projects = body.getChildElements(bodyName);
SOAPElement project = (SOAPElement)projects.next();
Iterator projectNameIter = project.getChildElements(soapFactory.createName("projectName"));
SOAPElement projectNameEle = (SOAPElement)projectNameIter.next();
String projectName = projectNameEle.getValue();
File file = new File(projectName);
SOAPMessage reply = mf.createMessage();
SOAPHeader header = reply.getSOAPHeader();
header.detachNode();
SOAPBody replyBody = reply.getSOAPBody();
SOAPBodyElement bodyElement = replyBody.addBodyElement(soapFactory.createName("ack"));
bodyElement.addTextNode("OK");
DataHandler dh = new DataHandler(new FileDataSource(file));
AttachmentPart attachment = reply.createAttachmentPart(dh);
attachment.setContentId("123");
reply.addAttachmentPart(attachment);
reply.saveChanges();
response.setStatus(HttpServletResponse.SC_OK);
putHeaders(reply.getMimeHeaders(), response);
response.setContentType("text/xml");
ServletOutputStream replyOS = response.getOutputStream();
reply.writeTo(replyOS);
replyOS.flush();
replyOS.close();
putHeaders looks like:
Iterator it = headers.getAllHeaders();
while (it.hasNext())
{
MimeHeader header = (MimeHeader) it.next();
String[] values = headers.getHeader(header.getName());
if (values.length == 1)
{
res.setHeader( header.getName(), header.getValue());
}
else
{
StringBuffer concat = new StringBuffer();
int i = 0;
while (i < values.length)
{
if (i != 0)
{
concat.append(',');
}
concat.append(values[i++]);
}
res.setHeader(header.getName(), concat.toString());
}
}
If you are using Google app engine, like me, the problem is that GAE doesn't support com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParameterList which is used internally somewhere in the call chain of javax.xml.soap.SOAPConnection.call(). So you must use a workaround.
I personally did it by using java.net.HttpURLConnection instead of javax.xml.soap.SOAPConnection and manually sending and parsing SOAP messages.

How to pass UserNameToken to ASMX service?

I have an asmx web service and a test console app. I have added web service reference to the console app and calling it like this
Employee.Employee e = new TestService.Employee.Employee();
e.SomeMethod();
On every web service call there is a validation check which looks like this
private bool IsUserNameTokenPresent()
{
//Get current SOAP context
SoapContext ctxt = RequestSoapContext.Current;
UsernameToken user = null;
if (ctxt == null)
{
//This request is using a different protocol other than SOAP.
return false;
}
//Iterate through all Security tokens
foreach(SecurityToken tok in ctxt.Security.Tokens)
{
if (tok is UsernameToken)
{
user = (UsernameToken)tok;
}
}
if (user == null)
return false;
return true;
}
Question: How do I pass the Security Token so that I can test this service. Its always null.
Finally found the answer for this. I had to create my own SOAP header manually and pass it with the request. Here is some code. I had to create Nonce dynamically for every call, I will post it here if someone wants the code for that.
XmlDocument doc = new XmlDocument();
doc.InnerXml = #"<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope
xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'>
<soap:Header>
<wsse:Security soap:mustUnderstand='1'>
<wsse:UsernameToken wsu:Id='uuid_faf0159a-6b13-4139-a6da-cb7b4100c10c'>
<wsse:Username>UserID</wsse:Username>
<wsse:Password>Pass</wsse:Password>
<wsse:Nonce>" + nonce + #"</wsse:Nonce>
<wsu:Created>" + date + #"</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<FindBySelfId>
<specification>
<LastName>" + lastname + #"</LastName>
<FirstName>" + firstname + #"</FirstName>
<DateOfBirth>" + dob + #"</DateOfBirth>
<HomeZipCode>" + zip + #"</HomeZipCode>
<SSN4>" + ssn + #"</SSN4>
</specification>
</FindBySelfId >
</soap:Body>
</soap:Envelope>";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost/Employee/employee.asmx");
req.Headers.Add("SOAPAction", "https://<Namespace here>");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();