. Net calls php

Source: Internet
Author: User
Well, it is a direct request, but the parameter seems to be invalid. The return always prompts that the parameter is null to construct the soap request information StringBuildersoapnewStringBuilder (); soap. Append (? Xmlversion1.0encodingutf-8 ?); Soap. Append (soap-ENV: Envelopexmlns: soap-ENVschemas

Well, it is a direct request, but the parameter seems to be invalid. When it is returned, it always prompts that the parameter is null // construct the soap request information StringBuilder soap = new StringBuilder (); soap. Append ("? Xml version = \ "1.0 \" encoding = \ "UTF-8 \"? "); Soap. Append (" soap-ENV: Envelope xmlns: soap-ENV = \ "http: // schemas

Well, it is a direct request, but the parameter seems to be invalid. If it is returned, it always prompts that the parameter is null.

// Construct the soap request information
StringBuilder soap = new StringBuilder ();
Soap. Append (" ");
Soap. Append (" ");
Soap. Append (" ");
Soap. Append (" ");//
Soap. Append (" 244767 ");
Soap. Append (" ");
Soap. Append (" ");
Soap. Append (" ");

// Initiate a request
Uri uri = new Uri ("http: // xxxxxxxx/index. php? R = yar/tgoods ");
WebRequest webRequest = WebRequest. Create (uri );
WebRequest. ContentType = "text/xml; charset = UTF-8 ";
WebRequest. Method = "POST ";
Using (Stream requestStream = webRequest. GetRequestStream ())
{
Byte [] paramBytes = Encoding. UTF8.GetBytes (soap. ToString ());
RequestStream. Write (paramBytes, 0, paramBytes. Length );
}

HttpWebResponse res;
Try
{
Res = (HttpWebResponse) webRequest. GetResponse ();
}
Catch (WebException ex)
{
Res = (HttpWebResponse) ex. Response;
}
StreamReader sr = new StreamReader (res. GetResponseStream (), Encoding. UTF8 );
String strHtml = sr. ReadToEnd ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.