Web Service Proxy is ignorning SOAP:Header

I'm using a custom soap header to return any errors that are generated by sql server calls.

In my webserivce call to UpdatePatientPersonal I'm missing a stored procedure parameter so my ExecuteNonQuery is generating a SQLException which I catch. I take the necessary bits of info from this exception and add them to my custom Soapheader object.
I've registed the the outputted header using the SoapHeaderAttribute. I added in a tracer to intercept the SOAP messages and to output them to a log file. When I make the call,
the logfile shows that the SoapHeader error is in place and that it contains the correct information.
however, on the client side, the soapheader variable on the proxy is null.
I've no idea what's wrong. I've regenerated the proxy files and still no joy. Has anyone seen this behaviour before?
My Header type is stored in a shared assembly.
Any help would be appreicated.
Tomas McGuinness
===============
tomasmcguinness@hotmail.com
www.chewedpencil.net
0
tomasmcg
2/22/2005 5:01:00 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

2 Replies
1247 Views

Similar Articles

[PageSpeed] 49
Get it on Google Play
Get it on Apple App Store

Can you provide some code on:

1. How you are adding the SOAP Header to the response on the web services end.
2. How you are reading the SOAP Header from the proxy.
Cristian Sturek
Principal SOA Architect
http://www.xwebservices.com
http://www.soahub.com
0
csturek
2/22/2005 5:49:32 PM
Edited by SomeNewKid. Please post code between <code> and </code> tags.



Sure csturek. Here is the Header class itself. I've omitted two of the properties for clarity.
Namespace DTCB.EPS.Shared.Type

<XmlRoot("SOAPError"), Serializable()> _
Public Class SOAPHeaderError
Inherits SoapHeader
Private _code As [Enum].ErrorCode = [Enum].ErrorCode.NONE
Private _source As String = String.Empty
Private _message As String = String.Empty
Public Property Code() As [Enum].ErrorCode
Get
Return _code
End Get
Set(ByVal Value As [Enum].ErrorCode)
_code = Value
End Set
End Property
End Class
End Namespace


On the web service side in a file called patientService.asmx I have the following:
Namespace DTCB.EPS.WebService

<System.Web.Services.WebService(Namespace:="http://tempuri.org//PatientService")> _
Public Class PatientService
Inherits WebServiceBase
<WebMethod(), SoapHeader("SOAPError", Direction:=SoapHeaderDirection.Out)> _
Function GetPatientClinical(ByVal PersonGID As Integer) As PatientClinicalCollection
Dim sqlConnection As sqlConnection = New sqlConnection(ConfigurationSettings.AppSettings.Item("ConnectionString"))
Dim ds As DataSet
Dim PatientClinicalCollection As PatientClinicalCollection = New PatientClinicalCollection
Try
sqlConnection.Open()
... Do stuff here...
End Function
End Class
End Namespace


In the type WebServiceBase I have a public variable called SoapError declared.
On the proxy side I have
        <System.Web.Services.Protocols.SoapHeaderAttribute("SOAPError",   Direction:=System.Web.Services.Protocols.SoapHeaderDirection.Out), _

System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org//PatientService/GetPatientClinical", RequestNamespace:="http://tempuri.org//PatientService",
ResponseNamespace:="http://tempuri.org//PatientService", Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function GetPatientClinical(ByVal PersonGID As Integer) As PatientClinicalCollection
Dim results() As Object = Me.Invoke("GetPatientClinical", New Object() {PersonGID})
Return CType(results(0), PatientClinicalCollection)
End Function
Public Function BeginGetPatientClinical(ByVal PersonGID As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
Return Me.BeginInvoke("GetPatientClinical", New Object() {PersonGID}, callback, asyncState)
End Function
Public Function EndGetPatientClinical(ByVal asyncResult As System.IAsyncResult) As PatientClinicalCollection
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0), PatientClinicalCollection)
End Function

The proxy also contains a shared variabled called SoapError which has SOAPHeaderError type.
I hope that's helpful.
Thanks

Tomas McGuinness
===============
tomasmcguinness@hotmail.com
www.chewedpencil.net
0
tomasmcg
2/23/2005 9:45:06 AM
Reply:

Similar Artilces:

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: http://msdn.microsoft.com/webservices http://www.microsoft.com/downloads/details.aspx?familyid=06255a94-2635-4d29-a90c-28b282993a41&displaylang=en https://www.sys-con.com/dotnet/article.cfm?id=458 Hope this helps....

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

New to web services, why does PB10 web service proxy wizard say there are no services?
here... http://webservices.amazon.com/AWSECommerceService/205-10-05/AWSECommerceService.wsdl oops typo... still doesn't show any services though... http://webservices.amazon.com/AWSECommerceService/2005-10-05/AWSECommerceService.wsdl "Chance" <chance@booklog.com> wrote in message news:43b44cb3$1@forums-1-dub... > here... > > http://webservices.amazon.com/AWSECommerceService/205-10-05/AWSECommerceService.wsdl > Upgraded to 10.2x and now seems to be working...at least it created the proxy. "Chance" <chance@booklog.co...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="http://www.dynix.com/schema/book">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

How do I set a session ID in a web service SOAP header using a .NET proxy?
I have a web service proxy set up in PB 10.5. I need to set a session ID in the SOAP header so the web service can validate subsequent requests for this session. Is this possible? You can't modify the SOAP headers unfortunately. That capability is supposed to be forthcoming in an EBF/Maintenance Release, but I do not now of an specific timeframe. On 20 Apr 2006 13:40:54 -0700, "Libby Engelbret" <lengelbret@npomn.com> wrote: >I have a web service proxy set up in PB 10.5. I need to set a session ID in >the SOAP header so the web service can val...

web service SOAP Headers
If this isn't the right forum, let me know what is.Is there a difference between SOAP serialization and  and XML serialization.I have been reading heavily and am now quite confused.I understand that SOAP serialization produces XML, but perhaps without a specific schema or a scheme very different from XML. In the context of web services, the XML Serializer is used to produce XML in SOAP format. What you may be getting confused about is that there is also a "runtime serialization" subsystem. This can serialize data either using a Binary Formatter, or a SOAP Formatter. It...

SOAP Web Service Problem (problema con un web service)
Please help, I can't read a webservice method (webmethod) from asmx web service, with Delphi firemonkey, In my first try I put a WDSL Importer, and I can retrive data from simplex type (string, booleans, integers) but when the method returns a DataSet, i loose my way. Por favor, ayuda, no puedo leer datos de un web service si el metodo que regresa es un DataSet, el web service esta hecho en dot.net así que es un asmx, utilizando el WDSL importes, traje datos sencillos como enteros, boleanos y otros, pero en el caso de arreglos como un DataSet no lo he conseguido, estoy perdido, y l...

Is web services a part of web Service?
  I have a question: Is web services a part of web server?? And when the client calls web service, it means that client calls web server?? Or is it a different entity in itself which communicates separately both with client and server and acts as middleware application.. I am very confused.. Can someone explain me the architecture...??? Thanks..Dont forget to click "Mark as Answer" on the post that helped you.This credits the member,earns you a point & marks your thread as Resolved so that new users will know where to search for their queries. When you build and dep...

Calling a Web Service from a Web Service
Hello,I was looking for some feedback on calling a web service from within a web service. I've heard that it's not good practice (or not possible). I have a scenario where I think it might make some sense.Within our infrastructure, we've created a web service that handles incoming updates on the statuses of all processes. This has proven to be a good thing since it allows applications to communicate across server to make status updates. It's also used by third party developers and applications to communicate with our infrastructure.Along these lines ... we are planning to create a new compon...

what are web services and what are the advantages of web services?
 Hello  i am new to this .net stuff and i was ask on the job interview what a web services is?and if i did not know given that i had a project ( as a project manager,  or a web developer)   what  is it? how do i start a >NET project on it? what are the main advantages is?  HOW DO I START THIS IN THE INTERVIEW>  and what basic books do i buy?   Hi There, There plenty of source on the net about webservice Definiton: http://en.wikipedia.org/wiki/Web_service http://www.codeproject.com/Purgatory/Defining_Web_Services.asp...

Web Site Project: How to configure web service URL in web.config (web service defined in a referenced DLL)
I have a web site that references a business logic DLL project. In the business logic project, there is a web service defined in its app.config file something like this: <applicationSettings>  <MyNamespace.BLL.Properties.Settings>    <setting name="MyNamespace_BLL_MyServer_ServiceName" serializeAs="String">    <value>http://blah.blah.blah.asmx</value>  </setting>  </MyNamespace.BLL.Properties.Settings></applicationSettings> When the web site is published, the web ...

create valid xml to send to web service based on the schema provided by web service
Problem: I have a web page which is being populated from a dataset containing multiple tables.  I now need to call a web service and send the majority of this data to be incorporate into a mainframe system.  I have been supplied with the schema that the web service will be using to validate the data.  I am new to web services and I am not sure how to take my existing dataset and transform it into an xml document that matches the schema I was provided with. There is a main schema with an element which is a custom complex type.  This custom type consists of an element whi...

Best Practice for .Net Web Service access to a Web Service on a Test and Production Servers
Hello All, What is the best way to control a .Net web service to be able to access a remote server for testing and then point to another remote server to access the web service in production? Do I need to generate and maintain 2 different proxy objects? TIA, Bob Bob // first create the proxy if not isvalid( i_service) then i_service = create fundtraderproxy_TradeServicesClient_BasicHttpBinding_ITradeServices end if ///You'll see code something like this in the constructor of your proxy //dynamically set the endpoint url with the user supplied value - //r...

Web resources about - Web Service Proxy is ignorning SOAP:Header - asp.net.xml-web-services

Resources last updated: 12/21/2015 11:20:34 PM