Null result from tibco webservice call in vb.net - asp.net

I took the wsdl file given by a tibco web service and I put it in my project, after that I created the web reference giving to vs 2005 (yes I'm working on a legacy project) that wsdl file. VS 2005 generated the proxy and I used it in my vb.net code.
When I call the method exposed by the proxy I always get a null result. If I call the service with soapUI it give a correct response with expected data. How this is possible? The wsdl is given by the tibco service itself how can vs 2005 misunderstand the result of the call?
Many thanks in advance for any answer.
My vb code is:
Dim EvalError As Company.FrontEnd.Agents.Ws_EvaluateAgency.tnsERRORAlpha
Dim EvaluateOutput() As Company.FrontEnd.Agents.Ws_EvaluateAgency.tnsPNREvaluate
EvaluateInput.EvaluationOption.EvaluatorOption.ElaborationMode = FrontEnd.Agents.Ws_EvaluateAgency.tnsTypeOfElaboration.AutopilotAgy '' Fase III
EvalError = ws_Valutazione.AgencyEvaluate(EvaluateInput, EvaluateOutput)
The input object have correct data. The output object is defined an so the EvalError
SOLVED: Was missing namespace specification in wsdl:input and wsdl:output tag of the wsdl

SOLVED: Was missing namespace specification in wsdl:input and wsdl:output tag of the wsdl
For an unknown (for me) reason you MUST set namespace="http://InputMessageNamespace" in wsdl:input and namespace="http://OutputMessageNamespace" in wsdl:output

Related

Could not find default endpoint element that references contract 'Service' error in consuming web Services in asp.net mvc

I have a problem when calling web Services in ASP.net MVC , I do the following
add the web service by add service reference to solution, and I include the service.cs file to the solution also, but when I try to create object in home controller , I have the following error
Could not find default endpoint element that references contract 'Service' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
can any one help me please
thanks
There's a couple things going on here. First, you're using SVCUTIL to generate a proxy and configuration settings for a non-WCF service - .asmx is legacy. I was able to generate a proxy and config settings, but to overcome the error you got you need to call one of the overloaded versions of WeatherHttpClient.
I'm not 100% sure, but this is what I think based on what I observed.
The reason is because there are two endpoints defined in the configuration file (one for SOAP 1.1 and one for SOAP 1.2), and since both endpoints are named there is no default endpoint to choose from.
When I used var x = new WeatherHttpClient(new BasicHttpBinding("WeatherSoap"), new EndpointAddress("http://wsf.cdyne.com/WeatherWS/Weather.asmx")); I was able to create the proxy just fine.
However, when I called GetCityForecastByZip I got the following error:
Server did not recognize the value of HTTP Header SOAPAction: http://ws.cdyne.com/WeatherWS/WeatherHttpGet/GetCityForecastByZIPRequest.
So then I used WSDL.exe to generate the proxy a la .ASMX style. I included that in my project, and the following code returned a result (after including a reference to System.Web.Services - I was using a console app):
var x = new Weather();
ForecastReturn result = x.GetCityForecastByZip("91504");`
I would suggest for simplicity using WSDL.exe to generate the proxy for your service, as it seems to be simpler.
I will also add that I've done very little MVC, but I don't think this is an MVC issue. I hope this helps you.

.NET 2.0 Web service creating new objects when null supplied via soap

I have an ASP.NET 2.0 web service and am using it in (among other things) an Adobe Flex application. I have a strange issue where if I send an object to the web service using soap with some fields that are null the webservice is actually creating new objects on the other end (and not putting any data in them).
The XML being sent looks like this:
<tns:Item>
<tns:Id>-1</tns:Id>
<tns:SomeField>21114</tns:SomeField>
<tns:SomeFieldThatShouldBeNull xsi:nil="true"/>
<tns:SomeFieldThatShouldBeNull2 xsi:nil="true"/>
</tns:Item>
In this example SomeFieldThatShouldBeNull and SomeFieldThatShouldBeNull2 are being created as new objects by the webservice. It is vital for the application that does not happen. What could be causing this?
Google, MSDN and the ASP.NET forums have not come up trumps so far.
Fixed by random prodding. It seems that I have to put the following attribute on the field in the .NET code to get it to treat a field with an xsi:nil="true" attribute as a null value:
[System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]

Consuming a Web Service from a Class Library

Using Visual Studio I have a Class Library (C#) where I added a reference to a Service (more preciselly a Web Service).
The Web Service classes and interfaces where generated correctly, and I am trying to consume them using the following code (the web service receives an returns a string):
CallWS request = new CallWS();
request.input = "input string";
WSClient client = new WSClient();
CallWSResponse response = client.CallWS(request);
The last line originates the following exception:
Could not find default endpoint element that references contract 'WS_INTER' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
How do I solve this?
You have to add an application configuration file and set up system.serviceModel section defining the address of a service.
You can certainly do that in code. Check this or MSDN for description

Possible SOAP version mismatch

I have a problem with web service connection. It says,
Possible SOAP version mismatch:
Envelope namespace
http://schemas.xmlsoap.org/wsdl/ was
unexpected. Expecting
http://schemas.xmlsoap.org/soap/envelope/.
when i call webservice's method. Do you have any idea about my problem?
It looks like you're providing the wrong namespace when creating the SOAP envelope - it should look similar to this:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
It's the third one that is probably wrong in your case.
I ran into the same issue dealing with a legacy web service hosted on a mainframe(obviously not .net). The url for the service was specified in the config of the client, but the wsdl file had not been included in the deployment. I suspect that on the initial call, the .Net client attempted to retrieve a fresh wsdl. The service wasn't expecting that and we received the "Possible SOAP version mismatch" error.
We encountered this error, because we set the c#-WebServiceProxy-URL to a wrong value.
we did
WebService ws = new WebService();
ws.Url = "http://URL_TO_WEBSERVICE?WSDL";
var response = ws.CallFunction()
Here the ?WSDL at the end of the URL caused the error.

"maximum string content length quota (8192) has been exceeded while reading XML data" calling WCF via mexAddress moniker

I'm attempting to call a WCF service via mex from a classic ASP page. I've got the call working using the details on MSDN, but if I pass back an amount of data exceeding 8K I get an exception stating:
The maximum string content length
quota (8192) has been exceeded while
reading XML data. This quota may be
increased by changing the
MaxStringContentLength property on the
XmlDictionaryReaderQuotas object used
when creating the XML reader...
The fix for this is easy enough in .NET client: you can adjust the client config to having a binding with a readerQuotas section including an increased quota. However, since I'm building a service moniker to pass to a GetObject call within ASP, I don't have access to a config to edit. If it were a VB6 app, I could use dllhost.exe.config, but that's not the case. The bindingConfiguration node (and sub nodes) don't appear to be parameters I can set within the moniker string.
Any ideas on how I could influence this parameter within the ASP context? ASP snippet with moniker string referenced below:
Dim strXml, moniker, objProxy
moniker="service:mexAddress='http://localhost/SomeApp/SomeServices/SomeService.svc/mex', "
moniker=moniker + "address='http://localhost/SomeApp/SomeServices/SomeService.svc',"
moniker=moniker + "contract=ISomeService, contractNamespace=http://foo.com, "
moniker=moniker + "binding=WSHttpBinding_ISomeService, bindingNamespace=http://foo.com"
Set objProxy = GetObject(moniker)
strXml = objProxy.DoWork("foo", "bar")
Thanks!
Try setting your maxStringContentLength in your wcf binding configuration on the server side.
It's my understanding that the service:mexAddress moniker actually uses a WCF client behind the COM interface. If that is the case then you can store the WCF config in a file called «foo».exe.config, where «foo» is replaced by the name of the executable.
If you are running the ASP within IIS6 or IIS7, then the EXE that runs the ASP is probably w3wp.exe, which means you need to drop the config into a file called w3wp.exe.config , located in the directory c:\Windows\system32\inetsrv.

Resources