Plater 7,872
Recognized Expert Expert
I have a webservice that claims the following: SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values. -
POST /testdb/UnitReporting.asmx HTTP/1.1
-
Host: localhost
-
Content-Type: text/xml; charset=utf-8
-
Content-Length: length
-
SOAPAction: "http://mylocation/UpdateInformation"
-
-
<?xml version="1.0" encoding="utf-8"?>
-
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
-
<soap:Body>
-
<UpdateInformation xmlns="http://mylocation/">
-
<WhenSent>dateTime</WhenSent>
-
<StatusMessage>string</StatusMessage>
-
</UpdateInformation>
-
</soap:Body>
-
</soap:Envelope>
-
Now I tried to produce this using HttpWebRequest and sent the following(pulle d from a packet watcher): -
POST /testdb/UnitReporting.asmx/UpdateInformation HTTP/1.1
-
Content-Type: text/xml; charset=utf-8
-
SOAPAction: http://mylocation/UpdateInformation
-
Content-Length: 450
-
Host: localhost
-
-
<?xml version="1.0" encoding="utf-8"?>
-
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
-
<soap:Body>
-
<UpdateInformation xmlns="http://mylocation/">
-
<WhenSent>12/30/2008 3:28:01 PM</WhenSent>
-
<StatusMessage>Nothing to report</StatusMessage>
-
</UpdateInformation>
-
</soap:Body>
-
</soap:Envelope>
-
For return result: -
HTTP/1.1 500 Internal Server Error
-
Server: Microsoft-IIS/5.1
-
Date: Tue, 30 Dec 2008 20:28:02 GMT
-
X-Powered-By: ASP.NET
-
X-AspNet-Version: 2.0.50727
-
Cache-Control: private
-
Content-Type: text/plain; charset=utf-8
-
Content-Length: 236
-
-
System.InvalidOperationException: Request format is invalid: text/xml; charset=utf-8.
-
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
-
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
-
If I use a regular old POST urlencoded style, i am able to execute the function fine, but trying to do soap fails saying the contenttype is wrong?
Any ideas?
Edit: The (correct version) code I use to produce this: - private static bool DoSoap11Style()
-
{
-
bool retval = false;
-
try
-
{
-
string test = "http://localhost/testdb/UnitReporting.asmx/UpdateInformation";
-
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(test);
-
hwr.Method = "POST";
-
hwr.ContentType = "text/xml; charset=utf-8";
-
hwr.Headers.Add("SOAPAction", "http://mylocation/UpdateInformation");
-
-
string postData = GetPostDataSoap11();
-
byte[] byte1 = Encoding.UTF8.GetBytes(postData.ToString());
-
hwr.ContentLength = byte1.Length;
-
Stream newStream = hwr.GetRequestStream();
-
newStream.Write(byte1, 0, byte1.Length);
-
newStream.Close();
-
-
HttpWebResponse hresp = (HttpWebResponse)hwr.GetResponse();
-
}
-
catch (Exception ee)
-
{
-
bool ignoreme = (ee.Message == "");
-
retval = false;
-
}
-
return retval;
-
}
-
-
private static string GetPostDataSoap11()
-
{
-
StringBuilder postData = new StringBuilder("");// "firstone=" + "";
-
postData.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n");
-
postData.Append("<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n");
-
postData.Append(" <soap:Body>\r\n");
-
postData.Append(" <UpdateInformation xmlns=\"http://mylocation/\">\r\n");
-
postData.AppendFormat(null, " <WhenSent>{0}</WhenSent>\r\n", DateTime.Now);
-
postData.AppendFormat(null, " <StatusMessage>{0}</StatusMessage>\r\n", "Nothing to report");
-
postData.Append(" </UpdateInformation>\r\n");
-
postData.Append(" </soap:Body>\r\n");
-
postData.Append("</soap:Envelope>\r\n");
-
-
return postData.ToString();
-
}
1 5960 Plater 7,872
Recognized Expert Expert
And in typical fashion, the problem turned out to be the one thing I thought for sure was right:
http://localhost/testdb/UnitReporting.a smx/UpdateInformati on
is used for regular POST, while
http://localhost/testdb/UnitReporting.a smx
is used for soap connections.
REDIT: I guess I had read something wrong, the best working format I have found for soap requests is this:
string datetimeformat = @"yyyy-MM-ddTHH:mm:ss"
Everything else results in the original "local" time transfered to be normalized to the server's local timezone
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Hans Kesting |
last post by:
Hi,
I'm trying to create a client for some webservice. BUT I have only
limited information:
* no WSDL available ("expected Q1-06") (it seems to be written in Java)
* I don't have access (yet) to the real webservice
* I *do* have example SOAP messages
What I'm trying to do is to build a dummy webservice, which should accept
(and respond with) the same SOAP messages. Then I can build my code
|
by: Jinashe |
last post by:
what do i need to enable accessing of webservices from a clients PC
i'm hosting some webservices from my server in VB.NET.
i've got some client windows applications done in VB.NET.
what have i got to install on the clients PC to be able to access these
webservices??
Will just the .NET Framework suffice???
Or do i have to install SOAP??
note - the OS of the client can be win98, win2K, win3000, winXP
|
by: stephan querengaesser |
last post by:
hi ng,
i try to invoke a webservice-method with an filter-object, that
contains value types. if i don´t want to filter the return value of
the method, i have to pass a new instance of the filter-object without
setting any properties. but the value type-properties can´t be null
and the filter is set to 0 (int) or false (bool).
therefore i did implement the propertySpecified-pattern like this:
|
by: Christian Wilhelm |
last post by:
Hi!
I'm trying to call a Java WebService out of a .net Client. There are two
Methods, one Method requires one Parameter of type Parameter, the other
Method requires one Parameter of type Parameter.
I can call the first Method without Problems, the Parameter can be
deserialized by the WebService.
But if I want to call the second Method and give it an Array of Parameters,
then the following exception is thrown by the WebService:...
|
by: Nalaka |
last post by:
Hi,
I created a sinple web service that returns a dataSet.
Then I created a client program that uses this web service (that returns the
Dataset).
My question is, how did the client figure out to create a "DataSet" as the
return type from the webservice?
| |
by: Kaush |
last post by:
Hi all,
I am creating a webservice to accept SOAP messages, parse the
message and send a SOAP response back to the client accessing my web service
using WSE-2 in ASP.NET.
I am creating a class which derives from "SoapReceiver" class and
do the processing here. To register this class by using the HTTP protocol, I
am editing the "web.config" file. I am adding an "add" element to this config
file as follows:
<httpHandlers>
|
by: jens Jensen |
last post by:
Hello ,
i'm calling a webservice generated with oracle webservice java tools.
I'm not able to add a web reference to a .net client the usual way with
visual studio 2005.
I was therefore provided with a set of Dll that implement the proxy needed
to consume this web service.
I'm now wrapping these dlls in a .Net webservice that can be consumed with
Visual studio the familliar way.
|
by: rakeshkumawat |
last post by:
I am facing a problem while reading the result which is loaded in DOMDocument.
In which I am sending a request to web service and getting a record of Single Order.
This is my VB Code which is i am using....
........................
Dim Connector As SoapConnector30 ' To connect to webservice
Dim Serializer As SoapSerializer30 ' To serialize the XML data
Dim Reader As SoapReader30 ' To read the Webservice...
|
by: VictorG |
last post by:
Hello,
I am trying to secure a webservice using WSE 3.0 and the turnkey
usernameForCertificateSecurity profile. I am passing a valid username
token, and on the server I have overridden the Authenticate token
call
and it is being called. My ASP.NET service has a Login() method and
it is being called during client application startup. Both the client
and service have matching policy config files. Once authentication
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |