[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using raw to post data



   This is how it's being done in C#. Does this shed any light? thanks!

   � � � ��private string httpPost()

   ������� {

   ����������� HttpWebRequest httpRequest;

   ����������� HttpWebResponse httpResponse;

   ����������� Stream httpPostStream;

   ����������� BinaryReader httpResponseStream;

   ����������� Byte[] postBytes;

   ����������� string xmlInput;

   ����������� Byte[] response;

   �
   ����������� ServicePointManager.SecurityProtocol =
   SecurityProtocolType.Ssl3;

   �
   �����������
   ������������xmlInput = request.Text;//.Replace("\r",
   "\r\n") + '\n' + '\r';

   �
   ����������� httpRequest =
   (HttpWebRequest)WebRequest.CreateDefault(new Uri(url.Text));

   ����
   �
   ����������� httpRequest.KeepAlive = persist.Checked;

   �
   �
   ����������� httpRequest.Method = "POST";

   �����������
   ������������httpRequest.Proxy.Credentials =
   System.Net.CredentialCache.DefaultCredentials;

   ����������� postBytes = Encoding.UTF8.GetBytes(xmlInput);

   �
   ����������� httpRequest.ContentLength = postBytes.Length;

   ����������� httpRequest.ContentType = contentType.Text;

   �
   ����������� httpPostStream = httpRequest.GetRequestStream();

   �
   ����������� httpPostStream.Write(postBytes, 0,
   postBytes.Length);

   ������������httpPostStream.Close();

   ����������� httpResponse =
   (HttpWebResponse)httpRequest.GetResponse();

   �
   ����������� httpResponseStream = new
   BinaryReader(httpResponse.GetResponseStream(), Encoding.ASCII);

   ����������� int lengthToRead = int.Parse(packetLength.Text);

   ����������� if (lengthToRead == 0)

   ��������������� lengthToRead =
   (Int32)httpResponse.ContentLength;

   ����������� response =
   httpResponseStream.ReadBytes(lengthToRead);

   ����������� return
   System.Text.Encoding.ASCII.GetString(response);

   ������� }

   On Tue, Mar 3, 2015 at 10:49 AM, Charles Wilt
   <[1]charles.wilt@xxxxxxxxx> wrote:

     � �As Paul points out, wireshark by itself can only capture data
     to/from
     � �your PC.
     � �You might be able to reconfigure your network switch to
     duplicate other
     � �traffic to your PC.
     � �However, easier just to start a comm trace on your IBM i to
     capture the
     � �packets it is sending.
     � �Charles
     � �On Tue, Mar 3, 2015 at 9:26 AM, Michael Ryan
     <[1][2]michaelrtr@xxxxxxxxx>
     � �wrote:
     � � ��  �Ok...I'm using Wireshark to capture the packets, but I
     seem to
     � � �be
     � � ��  �having problems. There's a test program that runs on
     my PC. I'm
     � � �able to
     � � ��  �capture and display the packets between my PC and the
     device.
     � � �That
     � � ��  �process works, and the packets are what I expect.�     � � ��  �I'm having a problem specifying two different hosts
     (the IBMi
     � � �and the
     � � ��  �device) for either capturing just those packets
     (capture
     � � �filter) or
     � � ��  �displaying just those packets (display filter). Any
     ideas? What
     � � �do I
     � � ��  �need to specify for capture and/or display filters to
     see all
     � � �the
     � � ��  �packets on the network that are between these two IP
     addresses?
     � � ��  �Thanks!
     � � ��  �On Mon, Mar 2, 2015 at 2:14 PM, Michael Ryan
     � � �<[1][2][3]michaelrtr@xxxxxxxxx>
     � � ��  �wrote:
     � � ��  �All good thoughts Mike. I plan on getting the traces
     tomorrow
     � � �with
     � � ��  �Wireshark. I'll share what I get in hopes you all can
     help!
     � � �Thanks!
     � � ��  �On Mon, Mar 2, 2015 at 2:01 PM, Mike Krebs
     � � ��  �<[2][3][4]mkrebs@xxxxxxxxxxxxxxxxxx> wrote:
     � � ��  �  �Do you have the C# code running? Or are you using
     it as
     � � �template to
     � � ��  �  �work from? If you have working code and are not
     sure of the
     � � ��  �  �parameters, then wireshark is probably a good
     idea.�� If it
     � � �is just
     � � ��  �  �a template, share the C# code if you can and one
     of the
     � � ��  �  �multi-lingual programmers will help interpret.
     � � ��  �  �Considering it appears to be some sort of error
     with the
     � � ��  �  �communication, I would go back to the "am I
     hitting a valid
     � � �url?"
     � � ��  �  �question. And that, the wireshark will help with.
     You should
     � � �clearly
     � � ��  �  �see the POST information being sent in the
     wireshark.
     � � ��  �  �Since appears to be a credit/debit system, I
     assume the data
     � � �itself
     � � ��  �  �is going to be encrypted by TLS in the wireshark.
     So, that
     � � �is not
     � � ��  �  �going to be much help.
     � � ��  �  �Should your URL be https:?
     � � ��  �  �-----Original Message-----
     � � ��  �  �From:
     [3][4][5]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � � ��  �  �     [mailto:[4][5][6]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On
     � � �Behalf Of
     � � ��  �  �Michael Ryan
     � � ��  �  �Sent: Monday, March 2, 2015 11:07 AM
     � � ��  �  �To: HTTPAPI and FTPAPI Projects
     � � ��  �  �Subject: Re: Using raw to post data
     � � ��  �Ok...I'm getting a -1 here in recvresp:
     � � ��  �eval�� �� �� wwRec = comm_lineread( peComm
     � � ��  ��� �� �� �� �� �� �� �� �� �� ��     �� �� �� �� �:
     � � �wwPos
     � � ��  ��� �� �� �� �� �� �� �� �� �� ��     �� �� �� �� �:
     � � �wwLeft
     � � ��  ��� �� �� �� �� �� �� �� �� �� ��     �� �� �� �� �:
     � � �peTimeout )
     � � ��  �It then throws the 'recvresp(): end with err message.
     � � ��  �Wireshark is my option?
     � � ��  �Thanks...
     � � ��  �On Fri, Feb 27, 2015 at 4:30 PM, Charles Wilt
     � � ��  �<[5][6][7]charles.wilt@xxxxxxxxx>
     � � ��  �wrote:
     � � ��  �>�� �� The C# code might be helpful...
     � � ��  �>�� �� I'd guess if it's doing a HTTP post, you'll
     be able to
     � � �use HTTP
     � � ��  �API...
     � � ��  �>�� �� The wireshark capture certainly will.
     � � ��  �>�� �� Charles
     � � ��  �>�� �� On Fri, Feb 27, 2015 at 3:37 PM, Michael
     Ryan
     � � ��  �<[1][6][7][8]michaelrtr@xxxxxxxxx>
     � � ��  �>�� �� wrote:
     � � ��  �>
     � � ��  �>�� �� �� ��  �I think you're right. I just
     asked them for
     � � �what is
     � � ��  �actually
     � � ��  �>�� �� �� sent and
     � � ��  �>�� �� �� ��  �received by the device, and
     they gave me
     � � �some C# code
     � � ��  �(with
     � � ��  �>�� �� �� does do an
     � � ��  �>�� �� �� ��  �HTTP POST) and the XML.
     � � ��  �>
     � � ��  �> References
     � � ��  �>
     � � ��  �>�� �� 1. mailto:[7][8][9]michaelrtr@xxxxxxxxx
     � � ��  �>
     � � ��  �>
     � � ��     � � ��     ------------------------------------------------------------------
     � � �----
     � � ��  �  �> - This is the FTPAPI mailing list.�� To
     unsubscribe,
     � � �please go to:
     � � ��  �>
     [8][9][10]http://www.scottklement.com/mailman/listinfo/ftpapi
     � � ��  �>
     � � ��     � � ��     ------------------------------------------------------------------
     � � �----
     � � ��  �> -
     � � ��  �>
     � � ��  �>
     � � ��     � � ��     ------------------------------------------------------------------
     � � �-----
     � � ��  �This is the FTPAPI mailing list.�� To unsubscribe,
     please go
     � � �to:
     � � ��  �     [9][10][11]http://www.scottklement.com/mailman/listinfo/ftpapi
     � � ��     � � ��     ------------------------------------------------------------------
     � � �-----
     � � �References
     � � ��  �1. mailto:[11][12]michaelrtr@xxxxxxxxx
     � � ��  �2. mailto:[12][13]mkrebs@xxxxxxxxxxxxxxxxxx
     � � ��  �3.
     mailto:[13][14]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � � ��  �4.
     mailto:[14][15]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � � ��  �5. mailto:[15][16]charles.wilt@xxxxxxxxx
     � � ��  �6. mailto:[16][17]michaelrtr@xxxxxxxxx
     � � ��  �7. mailto:[17][18]michaelrtr@xxxxxxxxx
     � � ��  �8.
     [18][19]http://www.scottklement.com/mailman/listinfo/ftpapi
     � � ��  �9.
     [19][20]http://www.scottklement.com/mailman/listinfo/ftpapi
     � �     �------------------------------------------------------------------
     --
     � � �---
     � � �This is the FTPAPI mailing list.�  To unsubscribe, please
     go to:
     � � �[20][21]http://www.scottklement.com/mailman/listinfo/ftpapi
     � �     �------------------------------------------------------------------
     --
     � � �---
     References
     � �1. mailto:[22]michaelrtr@xxxxxxxxx
     � �2. mailto:[23]michaelrtr@xxxxxxxxx
     � �3. mailto:[24]mkrebs@xxxxxxxxxxxxxxxxxx
     � �4. mailto:[25]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � �5. mailto:[26]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � �6. mailto:[27]charles.wilt@xxxxxxxxx
     � �7. mailto:[28]michaelrtr@xxxxxxxxx
     � �8. mailto:[29]michaelrtr@xxxxxxxxx
     � �9. [30]http://www.scottklement.com/mailman/listinfo/ftpapi
     � 10. [31]http://www.scottklement.com/mailman/listinfo/ftpapi
     � 11. mailto:[32]michaelrtr@xxxxxxxxx
     � 12. mailto:[33]mkrebs@xxxxxxxxxxxxxxxxxx
     � 13. mailto:[34]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � 14. mailto:[35]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     � 15. mailto:[36]charles.wilt@xxxxxxxxx
     � 16. mailto:[37]michaelrtr@xxxxxxxxx
     � 17. mailto:[38]michaelrtr@xxxxxxxxx
     � 18. [39]http://www.scottklement.com/mailman/listinfo/ftpapi
     � 19. [40]http://www.scottklement.com/mailman/listinfo/ftpapi
     � 20. [41]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---
     This is the FTPAPI mailing list.� To unsubscribe, please go to:
     [42]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---

References

   1. mailto:charles.wilt@xxxxxxxxx
   2. mailto:michaelrtr@xxxxxxxxx
   3. mailto:michaelrtr@xxxxxxxxx
   4. mailto:mkrebs@xxxxxxxxxxxxxxxxxx
   5. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   6. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   7. mailto:charles.wilt@xxxxxxxxx
   8. mailto:michaelrtr@xxxxxxxxx
   9. mailto:michaelrtr@xxxxxxxxx
  10. http://www.scottklement.com/mailman/listinfo/ftpapi
  11. http://www.scottklement.com/mailman/listinfo/ftpapi
  12. mailto:michaelrtr@xxxxxxxxx
  13. mailto:mkrebs@xxxxxxxxxxxxxxxxxx
  14. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  15. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  16. mailto:charles.wilt@xxxxxxxxx
  17. mailto:michaelrtr@xxxxxxxxx
  18. mailto:michaelrtr@xxxxxxxxx
  19. http://www.scottklement.com/mailman/listinfo/ftpapi
  20. http://www.scottklement.com/mailman/listinfo/ftpapi
  21. http://www.scottklement.com/mailman/listinfo/ftpapi
  22. mailto:michaelrtr@xxxxxxxxx
  23. mailto:michaelrtr@xxxxxxxxx
  24. mailto:mkrebs@xxxxxxxxxxxxxxxxxx
  25. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  26. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  27. mailto:charles.wilt@xxxxxxxxx
  28. mailto:michaelrtr@xxxxxxxxx
  29. mailto:michaelrtr@xxxxxxxxx
  30. http://www.scottklement.com/mailman/listinfo/ftpapi
  31. http://www.scottklement.com/mailman/listinfo/ftpapi
  32. mailto:michaelrtr@xxxxxxxxx
  33. mailto:mkrebs@xxxxxxxxxxxxxxxxxx
  34. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  35. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  36. mailto:charles.wilt@xxxxxxxxx
  37. mailto:michaelrtr@xxxxxxxxx
  38. mailto:michaelrtr@xxxxxxxxx
  39. http://www.scottklement.com/mailman/listinfo/ftpapi
  40. http://www.scottklement.com/mailman/listinfo/ftpapi
  41. http://www.scottklement.com/mailman/listinfo/ftpapi
  42. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------