.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

how to convert a byte[] to a xsd:hexBinary in the WSDL generated of a WCF service

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :WCF

Hi, i always see a byte[] type in the contract gets converted into a base64Binary type. What should i do in my WCF service contract so that the date type in the WSDL comes out to hexBinary ?

Will appreciate your help.


View Complete Post

More Related Resource Links

Is it possible to convert WSDL file back to Service Contract Interface for hosting? (WCF)


Hi there,

I would like to convert WSDL file to Service Contract Interface for hosting purposes. I know there is an option  to create proxy classes for clients using SVCUtil.exe or WSDL.exe. But this is not i would like to do.

I have a situation where, one of our clients have already hosted webservice. And I need to host a similar webservice. so to do it I must hand craft whole service contract Interface from the scratch. So without writing from the start can I use the existing WSDL to create the service contract Interface and the implementation class automatically with some tool?



C# reading Java/Php/SOAP service, WSDL generated file missing some namespace information

I'm trying to use a Web Service, which I believe is Java/php/SOAP, using C#.
I can connect and send fine, but the results, which are an array of information,
is null. The return is not instant, and I can get back errors.
I believe the problem is in the WSDL translation. The actual response coming back
does not line up with the WSDL generated code in reguards to namespaces. In
perticular, 'getCategoryTreeResponse' & 'getCategoryTreeResult' do not show up 
in the generated file.
I'm quite sure the WSDL file provided is poorly written but I have no control
over it. WSDL.exe only works when I pass a saved copy of the web service's
provided WSDL information due to the way it is called.

Convert WSDL file to asmx service WebMethod


Hi All,

Convert WSDL file to asmx

I have got wsdl file and based on wsdl  I am trying to create asmx service.

Wsdl file holding some credential user id and password it is working fine when I used SOAP UI tools

In same manner  when I am creating web method  like bellow given scarch code



     public string getHierarchy()


        string strResult="Hello", strRegion="";

       Service serviceProxy = new Service();

        UsernameToken userToken = new UsernameToken("admin", "password", PasswordOption.SendHashed);

        //SoapContext requestContext = serviceProxy.RequestSoapContext;


        smartForms objSmartForms = new smartForms();//Object of WSDL

       strResult = objSmartForms.getHierarchy("TLANTIC",out strRegion);//invoking Method

Convert WCF service to self hosting application


 I created project as a  WCF Service application and now according to recuriment that needs to be converted as a self hosting application

How can i do this?

Converting WCF service app to Self hosting app?

Cannot convert type 'object[]' to 'byte[]'


I am doing this .. and i want to convert object array to byte array. How should I do that?

Object[] myVal = um.myData;

Byte[] byteArray = (Byte[])myVal;

Expose DataTable from WCF service, all Generic lists convert to arrays

I added a method to a .Net 3.5 WCF web service that returns a DataTable.  Other methods in the web service return Generic lists and/or take Generic lists as parameters.  When I update my reference to the altered web service from my client application all generic lists used as parameters or return types from all methods in the web service are converted to arrays.  In my service reference settings I have selected "System.Collections.Generic.List."  Apparently this setting has no effect when a web service returns a DataTable? Is there any way to prevent this from occuring? Steps to reproduce: Create a web service with methods that return Generic lists and/or take Generic lists as parameters. In a client application reference the web service and select "System.Collections.Generic.List" as the collection type.  Verify that return types/parameter types are generic lists. Add a method to the web service that returns a DataTable.  In a client application update the service reference. Note that all Generic lists (either as return types or method parameters) have changed to arrays.  This occurs even though the collection type service reference setting remains as "System.Collections.Generic.List".  Tom Regan

Convert .NET web service to J2EE Web Service

Hi Are there any tools/process available to convert a .net webservice to j2ee web service. One of my project requires this migration. would be easy if there are any opensource or Java/Sun supported tools available for this task. Please let me know of any resources. Thanks

Generated WSDL - Remove prefix

ssdHi, My Service WSDL is generated with a "s:" prefix. How can I prevent this? ex: <s:schema elementFormDefault="qualified" targetNamespace="http://MyCompany.Services.Utils.LongNameServiceTest/"> <s:element name="Test"> <s:complexType /> </s:element> Thanks in advance, DD

Consuming Web Service. Dynamic WSDL ???

Hi everyone. I'm trying to consume a web service with my asp.net application. I've done the basic procedure of creating proxy classes but it won't work. After I spent hours debugging and talking to network support, I realized that a section within the WSDL was dynamic. The WSDL is located in a url like this: http://service/MyWebService?WSDL In the WSDL I have a section like this:<s0:service name="MyWebService"> <s0:port binding="s3:MyWebServiceSoap" name="MyWebServiceSoap"> <s4:address location="http://server1/MyWebService" /> </s0:port> </s0:service> If I press F5 on the browser, the WSDL shows a different address (only the server changes, actually). The range goes from server1 to server9. I've been informed that this service was hosted with some sort of balance system that redirect the requests amongst different servers according to a number of rules. I was also told that I only needed permission to access the balance server ("service"). So, I actually can't see those other "real" servers. When I generated my proxy classes, WSDL showed a path for server1. When I run my application I get a connection error ponting to the IP of server1. They said they can't give me permission to connect directly to server1 because it would kill the balance system. So, how can I con

WSDL Generated with my.svc?wsdl

I can get WSDL generated by WCF, if I simply point my web browser to URL: http://myhost/iisvirdir/my.svc?wsdl Generated WSDL contains entries like the following: <wsdl:operation name="callname"> <soap:operation soapAction="http://myhost/mypath/myservice/callname" style="document" /> <wsdl:input>   <soap:body use="literal" /> </wsdl:input> <wsdl:output>   <soap:body use="literal" /> </wsdl:output> </wsdl:operation> I see that input and output are always set to use literal. As I understand input and output parameters are XML document and its format is not covered in this WSDL.  I certainly cannot tell what input datastructures are used as input and output parameters from this WSDL. Does it mean that WSDL generated by svc?wsdl is incomplete? If I use Microsoft Windows SDK svcutil tool to generate WSDL I also get associated XSD files. Here is the command I use: svcutil.exe /t:metadata http://myhost/iisvirdir/my.svc That produces a set of files: namespace1.xsd namesapce2.xsd tempuri.org.wsdl my.wsdl I know that with this set of files I can easily generate C# code to implement another WCF service or client. I am surprised to see that after I put so much effort in creating namespaces all over I still get tempuri.org.wsdl (with the same literals for input outpu

Incorrect hostname in EndPoint location in WSDL for a service with multiple bindings and with multip

We have a WCF web service that is exposed through multiple bindings.  The site is  accessed through multiple IP Addresses/Hostnames (internet/intranet).  Some of the bindings use http transport while others use https transport. The web application is configured to use .NET 4.0 with multipleSiteBindingsEnabled="true" so that we shouldn't have problems with multiple ip addresses/hostnames. What we see is that when the WSDL is accessed using a http based URL (external), the hostnames in the endpoint addresses for http transport based bindings in WSDL are correct (ie, they use the hostname header from the request) while the hostnames in the endpoint addresses for https transport based bindings in the WSDL are incorrect (ie, they do not use the hostname header in the request - they seem to use the hostname from the first available binding in IIS for that scheme and end up with the local machine names/ip addresses in the URL).   We could work around by setting the external hostname/ip in the first binding in IIS for the respective scheme, but then WSDLs accessed from intranet clients would have wrong URLS now. This happens the other way around as well, ie, when the WSDL is accessed using https, the https based addresses are fine, but http addresses in the WSDL are not correct. It looks like hostname header is used only for WSDL endpoint addre

How to add XML documentation to generated Schema for a RESTful service

I'm using the RESTful Starter Kit which automatically generates a Service help page. For each method there is a link to a Request Schema. How can I add documentation/comments for each DataMember in the DataContracts so that the description/comment shows up in the generated xml schema?

WCF : How to prevent an endpoint from being published in the service WSDL?

Suppose I have a WCF service which has 2 endpoints A and B. I want to enable mex/wsdl on this service but my requirement is that B should not be published in the WSDL. So to say B is only for internal purpose and clients should never be aware of it. Is there a way (most probably somehow using IWsdlExporterExtension), to remove this endpoint B from being published in the metadata?

How To convert existing web service to WCF Service


Hi All,

I have running existing web service in framework 2.0, but i want to convert all my service to framework 3.5 WCF Service..


Help Me what kind of steps i'll do ?



Ashwani Kumar 

Convert Text to Numeric in reports generated by Microsoft SQL Server 2000

Our programming team is producing Excel reports using Microsoft SQL Server 2000 and cannot seem to find a way to produce numeric data as numeric.  It is being produced in the spread sheet as text (with the green triangle in the corner of the cell).  If the user viewing the report has an older version of Excel they cannot even convert it to numeric manually. 

Is there a way to produce numeric data as numeric in the Excel report?

Issue with Proxy code when generated for WCF service



There is an issue I am going through when generating Proxy code for my WCF services. Whenever I generate Proxy code for services with methods having VALUE Type parameters, additional BOOL parameter <parameter>Specified is added to the generate Proxy Code.

So if I have method - Employee GetEmployee(int Id), the respective proxy code for this method will be - Employee GetEmployee(int Id, bool IdSpecified).

Moreover, if you do not set this bool parameter value to TRUE, no value will be passed to the End service.

I can understand this can come handy when handling Null inputs, but that will not be always the case.

After doing some R&D, I found that if I add Data Format attribute of type RPC to my Method contract, these parameters are removed. Like if I add: 

[DataContractFormat(Style = OperationFormatStyle.Rpc)] , the generated proxy code reflects all value type parameters as is.

I am not an expert in WCF, and for the same reason I don't have much idea on what significance this attribute plays for the service methods. Can adding this attribute introduce problems when consuming these methods by application in .NET 1.1 or in JAVA?


Can anyone help me in getting ride of this additional parameter in the proxy?

Thanks in Advance.




How to Convert System.Drawing.Image Variable to Byte variable



I got a variable of type System.Drawing.Image and need to convert it to a variable of type byte so I can store the image in the database. Can someone show me how to do that in VB.NET code.

Thanks alot

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend