473,666 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change SOAP message before it's validation

Hi, All,

I have a very simple webmethod:

[WebMethod]
public string HelloWorld(int i)
{
return i.ToString();
}

when someone call this service to pass a empty string and I got the nasty
error like:
System.Argument Exception: Cannot convert Test to System.Int32.
Parameter name: type ---> System.FormatEx ception: Input string was not in a
correct format.
at System.Number.P arseInt32(Strin g s, NumberStyles style,
NumberFormatInf o info)
at System.String.S ystem.IConverti ble.ToInt32(IFo rmatProvider provider)
at System.Convert. ChangeType(Obje ct value, Type conversionType,
IFormatProvider provider)
at System.Web.Serv ices.Protocols. ScalarFormatter .FromString(Str ing value,
Type type)
--- End of inner exception stack trace ---
at System.Web.Serv ices.Protocols. ScalarFormatter .FromString(Str ing value,
Type type)
at
System.Web.Serv ices.Protocols. ValueCollection ParameterReader .Read(NameValue C
ollection collection)
at System.Web.Serv ices.Protocols. UrlParameterRea der.Read(HttpRe quest
request)
at System.Web.Serv ices.Protocols. HttpServerProto col.ReadParamet ers()
at System.Web.Serv ices.Protocols. WebServiceHandl er.Invoke()
at System.Web.Serv ices.Protocols. WebServiceHandl er.CoreProcessR equest()
Is there a way to override the behavior? I tried the SoapExtension and try
to change the empty string
Nov 21 '05 #1
1 2073
You cannot assign a null value to an int

"John" <jo*********@pu rsca.com> дÈëÏûÏ¢
news:#Y******** *****@tk2msftng p13.phx.gbl...
Hi, All,

I have a very simple webmethod:

[WebMethod]
public string HelloWorld(int i)
{
return i.ToString();
}

when someone call this service to pass a empty string and I got the nasty
error like:
System.Argument Exception: Cannot convert Test to System.Int32.
Parameter name: type ---> System.FormatEx ception: Input string was not in a correct format.
at System.Number.P arseInt32(Strin g s, NumberStyles style,
NumberFormatInf o info)
at System.String.S ystem.IConverti ble.ToInt32(IFo rmatProvider provider)
at System.Convert. ChangeType(Obje ct value, Type conversionType,
IFormatProvider provider)
at System.Web.Serv ices.Protocols. ScalarFormatter .FromString(Str ing value, Type type)
--- End of inner exception stack trace ---
at System.Web.Serv ices.Protocols. ScalarFormatter .FromString(Str ing value, Type type)
at
System.Web.Serv ices.Protocols. ValueCollection ParameterReader .Read(NameValue C ollection collection)
at System.Web.Serv ices.Protocols. UrlParameterRea der.Read(HttpRe quest
request)
at System.Web.Serv ices.Protocols. HttpServerProto col.ReadParamet ers()
at System.Web.Serv ices.Protocols. WebServiceHandl er.Invoke()
at System.Web.Serv ices.Protocols. WebServiceHandl er.CoreProcessR equest()
Is there a way to override the behavior? I tried the SoapExtension and try
to change the empty string

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1621
by: Meh-Lit Kim | last post by:
Hi All, I'd like to use SOAP 1.2 messaging in a document-centric fashion. Does anyone know - 1. What to do to validate an incoming SOAP message ? Do people write an XML schema for their application's SOAP messages which necessarily needs to reference the SOAP XML Schemas and then
4
4251
by: Peter Wullems | last post by:
I have created a schema to vallidate SOAP messages the first couple of lines are as follows: <?xml version="1.0" encoding="utf-8" ?> <SOAP-ENV:Envelope xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP- ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding /"> <SOAP-ENV:Header>
2
6837
by: Rick | last post by:
I have an XML document that is generated from Infopath, I need to change the value of a namespace that is defined in a node in the form: <xsf:xDocumentClass "xmlns:my=valuehere">. when i navigate to the namespace value it is read only and cannot be changed. Can anyone tell me how to change this value? My Code: Dim sSingleNode As XmlNode = objDoc.SelectSingleNode("//xsf:Node", NamespaceManager)
0
2933
by: Amar | last post by:
I am recieving the "The root element is missing" error from my soap extension while attempting to validate an incoming SOAP message request. I suspect the problem resides in the ChainStream method but I'm not sure. Below is a water-downed version of the code that I'm working on. While debugging, I noticed that if I pass an invalid SOAP request, the schema validation catches it and throws the error appropriately. However, when I pass in a...
6
2127
by: A.M-SG | last post by:
Hi, We are developing a SmartClient application and we are planning to expose business objects layer to SmartClient application by using ASP.NET SOAP web services.
7
2350
by: cj | last post by:
Simple Object Access Protocol is new to me. Can anyone point me to a simple soap example? I found something on MS site but they don't tell me what namespace to include for dim SOAPClient = New SOAPClient to work for example.
0
1739
by: glidin | last post by:
I'm hoping someone can help me with a SOAP signature validation issue I am having. A client is posting a signed SOAP envelope to our .NET web service and I am unable to validate their signature. They are using Java and a web logic server to post the request. I'm able to post a signed envelope and validate it using the SignedXml class when I create it myself, so I know the code is working properly. Or close to working properly. I've read...
0
3594
by: Patrick Brunmayr | last post by:
Hello I have a big Problem with validating a Soap Envelope. I have downloaded the xsd for a soap envelope from http://schemas.xmlsoap.org/soap/envelope/ The validation succeeds as lonng as i don't use elements in body with a xsi:type attribute! The Problem is that foo:person is an abstract type and foo:driver is dervived from it. So using a foo:person is not allowed until specifing
4
2451
by: thebjorn | last post by:
I've been trying to use SOAPpy and ZSI (with and without the use of wsdl2py) to communicate with a SOAP server (looks like it's a WebLogic server(?) in front of some enterprise java bean) and not having much luck. I got them to send me an example of what the bytes on the wire are supposed to look like (attached below), and I got it to "work" by going lo-tech: cn = httplib.HTTPSConnection('test.xx.no',443) cn.putrequest("POST",...
0
8454
marktang
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...
0
8785
jinu1996
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...
1
8560
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,...
0
5671
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();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.