Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use request and respond with xml and VB.net?
    primarykey
    data
    text
    <p>I was asked to send a request to a server to register online a transaction for a point gathering system. I don know much about this request-respond procedure.</p> <p>They told me that the request should be like this:</p> <pre><code>request( p1 - loginInfo:UN|PASS|MP1 p2 - XMLTransactionInfo (below) p3 - returnPointBalance:1 ) &lt;transaction&gt; &lt;partnernum&gt;000001&lt;/partnernum&gt; &lt;trxndate&gt;2012-10-&gt;12T07:18:27&lt;/trxndate&gt; &lt;cardnum&gt;1234567891234567&lt;/cardnum&gt; &lt;trxnamount&gt;5.4&lt;/trxnamount&gt; &lt;trxnpoints&gt;729&lt;/trxnpoints&gt; &lt;posnum&gt;000-001&lt;/posnum&gt; &lt;contactidnum&gt;&lt;/contactidnum&gt; &lt;contactphone&gt;357&lt;/contactphone&gt; &lt;trxnseqnum&gt;12345612345612&lt;/trxnseqnum&gt; &lt;/transaction&gt; </code></pre> <p>And the response should be like this:</p> <pre><code>response( &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;transactionresponse xmlns="C:\path\Sth.ear\Sth.war/xmlschema/TransactionResponse.rng"&gt; &lt;sequencenum&gt;123123121312&lt;/sequencenum&gt; &lt;errorcode&gt;0&lt;/errorcode&gt; &lt;errormessage&gt;&lt;/errormessage&gt; &lt;trxnnum&gt;6399575&lt;/trxnnum&gt; &lt;balancebefore&gt;1942&lt;/balancebefore&gt; &lt;balanceafter&gt;1213&lt;/balanceafter&gt; &lt;mpcontrib&gt;729&lt;/mpcontrib&gt; &lt;partnercontrib&gt;0&lt;/partnercontrib&gt; &lt;/transactionresponse&gt; ) </code></pre> <p>They also told me: "You can get the WSDL with this URL: url1..." and "The WS endpoint is: url2..."</p> <p>So far i've managed to do the following:</p> <pre><code>Dim request As WebRequest = Nothing 'Create a request for the URL. request =WebRequest.Create("URL1") 'set the credentials. Dim credentials As NetworkCredential loginUser = "username" loginPass = "pass" credentials = New NetworkCredential(loginUser, loginPass, "MP1") request.Credentials = credentials 'create the transaction xml request.ContentType = "text/xml" Dim transaction As XmlElement transaction = xml2.CreateElement("transaction") xml2.AppendChild(transaction) Dim partnernum As XmlElement partnernum = xml2.CreateElement("partnernum") partnernum.InnerText = "00001" transaction.AppendChild(partnernum) 'and so on until i create the exact same xml as above... </code></pre> <p>Then I print the XML file to the console for a visual check and then ask for response</p> <pre><code> 'print to console xml2.Save(Console.Out) Dim response As WebResponse = request.GetResponse() Console.WriteLine(response.ToString()) 'write the response to a textbox responseText.Text = response.Headers.ToString() </code></pre> <p>The result of the response in the textbox is</p> <pre><code>Content-Language: el-GR Transfer-Encoding: chunked Content-Type: text/xml Date: Thu, 13 Dec 2012 18:52:33 GMT Server: WebSphere Application Server/6.0 </code></pre> <p>Firstly which one of the 2 urls that they gave me I should I use?</p> <p>Secondly how can I create the request that they told me in order to get the response I am suppose to get?</p> <p>Is there any step by step guide for that?</p> <p>I am using VB.net, WinForms. Thank you for your time.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload