Calling WCF Service from Web Service Task
I'm doing a very simple test. I created a basic WCF Service with one method. GetData which takes an int. It's the code VS creates when you select WCF Service application. I removed the data contract from this service leaving only the GetData.I put this web service on a server and can hit it not problem from IE usinghttp://ehrtiger/TestWCF/Service1.svc?wsdlI get my wsdl and saved it.I then created a SSIS project.I dropped the Web Service task in the control flow.HTTP Connection is http://ehrtiger/TestWCF/Service1.svc and Test Connection was fine.I loaded the wsdl.On the input tab I selected my serviceTestWCFand the methodGetDataI even supplied the passed in value of 10.
I run it and get the following;[Web Service Task] Error: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: Method 'ProxyNamespace.TestWCF.GetData' not found.. at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebMethodInvokerProxy.InvokeMethod(DTSWebMethodInfo methodInfo, String serviceName, Object connection) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTaskUtil.Invoke(DTSWebMethodInfo methodInfo, String serviceName, Object connection) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".
What is "ProxyNamespace"? Why is this part of the method name?How do I fix this?Joe Pacelli
June 15th, 2009 4:31pm
After extensive searching on the web I was able to resolve this ProxyNamespace problem but now I'm presented with a whole new problem. [Web Service Task] Error: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: Object reference not set to an instance of an object.. at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebMethodInvokerProxy.InvokeMethod(DTSWebMethodInfo methodInfo, String serviceName, Object connection) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTaskUtil.Invoke(DTSWebMethodInfo methodInfo, String serviceName, Object connection, VariableDispenser taskVariableDispenser) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".So I did a bunch more testing. I created an ASP.NET Web service application. Only WebMethod is Hello World.I used the Web Service Task. And everything works fine.I created this same method in WCF Web Services and I get the following error above.I'm confused as to why asmx web services work and the svc web service doesn'tHere's the TestASP wsdl and the TestWCF wsdlTESTASP WSDL<?xml version="1.0" encoding="utf-8"?><wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="TestASP" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="TestASP" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="TestASP"> <s:element name="HelloWorld"> <s:complexType /> </s:element> <s:element name="HelloWorldResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </wsdl:types> <wsdl:message name="HelloWorldSoapIn"> <wsdl:part name="parameters" element="tns:HelloWorld" /> </wsdl:message> <wsdl:message name="HelloWorldSoapOut"> <wsdl:part name="parameters" element="tns:HelloWorldResponse" /> </wsdl:message> <wsdl:portType name="Service1Soap"> <wsdl:operation name="HelloWorld"> <wsdl:input message="tns:HelloWorldSoapIn" /> <wsdl:output message="tns:HelloWorldSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="Service1Soap" type="tns:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="HelloWorld"> <soap:operation soapAction="TestASP/HelloWorld" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="Service1Soap12" type="tns:Service1Soap"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="HelloWorld"> <soap12:operation soapAction="TestASP/HelloWorld" style="document" /> <wsdl:input> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="Service1"> <wsdl:port name="Service1Soap" binding="tns:Service1Soap"> <soap:address location="http://ehrtiger/TestASP/TestASP.asmx" /> </wsdl:port> <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12"> <soap12:address location="http://ehrtiger/TestASP/TestASP.asmx" /> </wsdl:port> </wsdl:service></wsdl:definitions>TESTWCF WSDL<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="TestWCF" targetNamespace="WCFTester" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="WCFTester" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"><wsdl:types><xsd:schema targetNamespace="WCFTester/Imports"><xsd:import schemaLocation="http://ehrtiger/TestWCF/Service1.svc?xsd=xsd0" namespace="WCFTester"/></xsd:schema></wsdl:types><wsdl:message name="ITestWCF_HelloWorld_InputMessage"><wsdl:part name="parameters" element="tns:HelloWorld"/></wsdl:message><wsdl:message name="ITestWCF_HelloWorld_OutputMessage"><wsdl:part name="parameters" element="tns:HelloWorldResponse"/></wsdl:message><wsdl:portType name="ITestWCF"><wsdl:operation name="HelloWorld"><wsdl:input wsaw:Action="WCFTester/ITestWCF/HelloWorld" message="tns:ITestWCF_HelloWorld_InputMessage"/><wsdl:output wsaw:Action="WCFTester/ITestWCF/HelloWorldResponse" message="tns:ITestWCF_HelloWorld_OutputMessage"/></wsdl:operation></wsdl:portType><wsdl:binding name="BasicHttpBinding_ITestWCF" type="tns:ITestWCF"><soap:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="HelloWorld"><soap:operation soapAction="WCFTester/ITestWCF/HelloWorld" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="TestWCF"><wsdl:port name="BasicHttpBinding_ITestWCF" binding="tns:BasicHttpBinding_ITestWCF"><soap:address location="http://ehrtiger/TestWCF/Service1.svc"/></wsdl:port></wsdl:service></wsdl:definitions>Any help would be appreciatedJoe Pacelli
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2009 7:54pm
Okay this is really strange now. My colleague actually was able to get this TestWCF web service task to work on his system. So we went to the WCF Web Service we are building which has about 8 methods currently. And again we are recieving the following message;[Web Service Task] Error: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: Method 'ProxyNamespace.EMRExtract.GetPatient' not found.. at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebMethodInvokerProxy.InvokeMethod(DTSWebMethodInfo methodInfo, String serviceName, Object connection) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTaskUtil.Invoke(DTSWebMethodInfo methodInfo, String serviceName, Object connection, VariableDispenser taskVariableDispenser) at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()". The problem isI changed the namespace information. And we even added the one test method to this webservice and it works fine. So how does one method work and another method fail from the same service, with the same namespace?This error message is not very descriptive.Joe Pacelli
June 16th, 2009 3:01pm
I don't have a specific answer to your problem. However, I am curious about which version of SSIS you are using. Also, you might try calling the web service from a script to see if you get better results. I've often found the Web Service task to be a bit flaky.John Welch | www.mariner-usa.com | www.agilebi.com | ssisUnit.codeplex.com
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2009 9:08pm
We need to use SSI 2005 so using the script task doesn't help since I can't add a web referenceJoe Pacelli
June 16th, 2009 11:02pm
That's true, but you can create a custom assembly and call it from your Script Task. It doesn't suprise me that 2005 doesn't work well with WCF, since it was a .NET 3.0 feature and SSIS 2005 was built around 2.0.John Welch | www.mariner-usa.com | www.agilebi.com | ssisUnit.codeplex.com
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2009 11:06pm
Joe, You say "After extensive searching on the web I was able to resolve this ProxyNamespace problem" - what was the solution that you found??? I haven't been able to find it. Thanks! TobyToby
August 31st, 2009 6:49pm
I managed it out compiling a DLL that calls the WS-* / WCF service.
The DLL exposes a static method to be called from a Script Task Shape.
The result is serilized so the method returns an XML string.
I put the resut in a variable, save it to a XML file.
Then I can use a XML Source DataTask shape to get the content of it.
cheers
Free Windows Admin Tool Kit Click here and download it now
December 23rd, 2010 5:46am