Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

How can I add attribute in header of a webservice?

$
0
0

I need to get context from a webservice which provide by our customer.

I add the webservice successfully.

Here is the code which to get the context:

ServiceReference1.CxfWebServiceApiClient Client = new ServiceReference1.CxfWebServiceApiClient();                                
ServiceReference1.sysUserOfWs SUOW=Client.getUserInfo("txhxl5h31111a", "123456");

Well, it failed and threws an error which let me contact my customer.

The customer told me that I need to add an attribute 'Code=123456' to the header or it must be failed.

Meanwhile, I know less about the webservice and I found someone using the HttpPost/HttpWebRequest or any other method to call the webservice in some tutorial.

I wanna know if my way is right and how to add an attribute in header of a webservice? Thank you.

---------------------------------------

What's more, I tried my customer's way in Postman and it works. It seems now the problem is how to achieve this in C#.


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>