The communication object, System.ServiceModel.ChannelFactory 'xxxxx', cannot be used for communication because it is in the Faulted state.

Hi, I'm using VS2013, C# and webform
In my web app I called a vendor's web service api that they created using Java.  
There is a problem with one of the class attribute of type DateTime in the Reference.cs file that was generated based on their wsdl.  I need to assign null to that attribute so the vendor recommended me to modified my local copy of wsdl and reference.cs for that field to be of string type.  It compiles fine, no problem there.

However, at run time when I created the client proxy class in C# I get the client proxy object state to be CommunicationState.Faulted and the exception message in the subject.

The vendor said their other C# customers were successful at this.  Is there some other step that I'm missing here?  I don't see how this can work when I only change the wsdl and the referece.cs files because I'm still calling their api that still has that field defined as DateTime.  

thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
the vendor recommended me to modified my local copy of wsdl
I wouldn't do that.

It means that you will use the service outside of its specifications.

Your problem description indicates that either

a) The WSDL is incorrect.
b) The Service Reference was imported with errors.

In the first case the vendor needs to fix it. And in the second case you should investigate the problem and open a Connect item or support case.

Does the vendor provides source samples? If so, then compare them with yours.
When not, use a Java test project to see what this sends over the wire in comparison to your code.

And last but not least: can you post the WSDL url?
lapuccaAuthor Commented:
Hi, thank you for your input.

There is no error with wsdl and service reference, well, originally.  The problem is this vendor's web service in C# generated variables with DateTime type which doesn't allow for null assignment.  I need DateTime? type for this.  The vendor suggested for me to modify my local copy of the wsdl and the C# generated fiel, Reference.cs.  However, that generated the error I posted here.  How t address this?  Thank you.
ste5anSenior DeveloperCommented:
I don't believe that. I've done a lot consuming and devolping web services. I never have such a problem..

Well. You can do what the vendor said.. But just read that advice again. They say, change the WSDL. Thus it's a vendor problem. q.e.d.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

lapuccaAuthor Commented:
The WSDL has been working.  Like I said, one of the field doesn't accept null value and creates problem in my C# code when I call this API.  I understand what you're saying and I can't agree with you more that this is vendor problem. However, they're not willing to fix this problem so they suggest for me to modify the wsdl but I'm getting this error.  

My question is do I need to generate a new web service out of the modified wsdl on my local PC?  And how can I do that?

Thank you.
ste5anSenior DeveloperCommented:
The problem is that the WSDL is a contract. Manipulating it, is well, working outside the contract..

And last but not least: The error messages tells you, that something went terribly wrong on the server side..

Cause just because you change the datetime field to string, does not necessarily allows NULL. Have you tried sending an empty string instead?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lapuccaAuthor Commented:
It's a DateTime field so it doesn't accept null or empty string since it's not a string field.  In C# DateTime field will put 1/1/0001 by default if no value is assigned.  I agree that best not to mess with that so I'm now just putting a stub date.  Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.