error while consuming WCF service from VB6 script - wcf

I got a simple WCF service written in C#. I need to consume the service from VB script using MS SOAP Toolkit 3.0. I wrote a simple client code like that:
Dim client
Set client = CreateObject("MSSOAP.SoapClient30")
client.MSSoapInit "http://localhost:8888/MyService.svc?wsdl"
I am hosting my service on IIS 7.5 (Windows 7). The error shows up during .MSSoapInit invocation:
HRESULT=0x1: result 0x1 incorrect function.
- WSDLReader:Could not find '/definitions/service' inside the 'default' namespace of the wsdl file HRESULT=0x80070057: The parameter is incorrect.
WSDLReader:Analyzing the WSDL file failed HRESULT=0x80070057: The parameter is incorrect.
Client:One of the parameters supplied is invalid. HRESULT=0x80070057: The parameter is incorrect.
If i run project from Visual Studio (ASP.NET development server) i don't have any troubles, i can consume service from my client code. Generated wsdl-schemas are equal for both cases (except the port number)
What could be a reason of this behaviour?

Related

SQL CLR Stored Procedure calling Web Service receives System.Net.WebException: The request failed with HTTP status 415: Unsupported Media Type

I have created a SQL CLR Project in Visual Studio 2012 (Target Framework: 3.5) that will call a Web Service (WCF). Initially, I had created a Web reference to the web service in the project, but I kept getting 'Could not load dynamically generated assembly' when executing the stored procedure created. After a lot of googling, I used wsdl utility to create a code from the web service's WSDL and add it to the project.
I had turned on the 'Generate serialization assembly' in the project's properties page to generate the Serialized DLL since sgen utility did not work for me. On the database (SQL Server 2008) side, I have enabled CLR and set the database's trustworthy to on.
Then, I registered the CLR assembly and the Serialized DLL in the database and created the procedure like so:
CREATE ASSEMBLY [Database] FROM 'C:\MyProject\bin\Debug\Database.dll' WITH PERMISSION_SET = UNSAFE;
CREATE ASSEMBLY [Database.XmlSerializers] FROM 'C:\MyProject\bin\Debug\Database.XmlSerializers.dll' WITH PERMISSION_SET = UNSAFE;
CREATE PROCEDURE [dbo].[XSP_AlertReachedMilestone] #milestoneID INT
WITH EXECUTE AS CALLER
AS EXTERNAL NAME [Database].[StoredProcedures].[XSP_AlertReachedMilestone]
But when I executed the Stored procedure, I received 'Unsupported Media Type' exception. I googled the error one of the suggestion recommended checking the SOAP versions of the client(Database) and web service. I have verified that the web service uses SOAP 1.2 but I don't know how to check what SOAP version the SQL Server is using.
Another suggested to check the content/mime type of the client (database), but again I don't know how to check this.
Any ideas how can I fix this error?
I have solved this issue. I found out that the problem was the web reference which do not work with WCF and CLR. After finding this out I generated the proxy class for the web service using wsdl.exe utility but it doesn't create the code correctly. Using svcutil.exe utility to generate the proxy class did the trick for me. I then add the proxy class generated to my project and compile the assembly.

Error while consuming WCF from class library from an application deployed on IIS 7.5

I am new to WCF services and getting an Error while consuming WCF from Class library, pls correct if i wrong somewhere; I m explaining my problem in steps
1.separate WCF project that is deployed in local IIS, running well from Visual studio(dev env).
2.created CustomClientChannelFactory class and consuming WCF from Business Layer(ie class library)
CustomClientChannelFactory<IPDServices.IIPDServices> objChannelFactory = new CustomClientChannelFactory<IPDServices.IIPDServices>("BasicHttpBinding_IIPDServices", "HISWCFService.config");
IPDServices.IIPDServices obj = objChannelFactory.CreateChannel();
strXML = obj.GetAllAdmittedPatients(strHospitalId);
binding information stored in HISWCFService.config (renamed App.config) and copied in
specified location (C:\Program Files\Common Files\microsoft shared\DevServer\10.0), this is working well on local VS WebDev server while debugging app.
problem started when i deployed App in IIS getting an Error
"The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified."
Please suggest

How to add service to a WCF Service library. Is this correct?

I am new to WCF and .Net application. So pardon me if I am asking some basic and silly question.
Basically my project is to create a WCF Service that would call an Oracle Stored Procedure that returns a set of parameters which is then passed to the Exchange Server to send Email.
For this so far I have done something like this:
In VS 2010 Create Project; Visual C#; WCF; select WCF Service Library.
Described as "A project for creating a WCF service class library (.dll)".
Gives an app.config
Debug brings up a WCF Service Host and a WCF Test Client automatically.
I initially followed the MSDN sample that is given below in the following website:
http://msdn.microsoft.com/en-us/library/ms731835.aspx
Now I Added another project to the same solution and chose WCF Service Application to host the above in IIS host. This gives me web.config file.
Before I proceed to my next question please let me know if the last step is correct or wrong?
To proceed further I tried to add my implementation service reference in web.config file.
When I try to debug I am getting a Service host that is running seperately (an icon on my machine) and a WCF Test Client opens up as well. Is this correct? Now how do I proceed further? I have no clue..
Now do I create methods that would call the Stored Procedure using Data access?
How do I proceed further? I am stuck. Please help.
Thank you.
You are on right path you just need to call your stored procedue and then call read the data and invoke method and pass it to client.
Here is full example with screenshot for your help
SQL Server
http://www.codeproject.com/Tips/468354/WCF-example-for-inserting-and-displaying-data-from
WCF Data Services and OData for Oracle Database
http://download.oracle.com/oll/obe/EntityFrameworkWCF/WCFEntityFramework.htm
Invoking Operations on the Oracle Database WCF
http://msdn.microsoft.com/en-us/library/dd788075%28v=bts.10%29.aspx

Unable to access WCF Service using InfoPath

I am consuming wcf service using infopath, I can easily access it through IE, but unable to access using InfoPath,
my wcf service is hosted on another server. I am getting this error :
WSDLReader:Could not find '/definitions/service' inside the '' namespace of the wsdl file. The parameter is incorrect.
- WSDLReader:Analyzing the WSDL file failed. The parameter is incorrect.
It was all working fine, but when server was restarted or shutdown, it has stopped working and am getting this error now. When I deployed the same webservice on the same server where my InfoPath form is, it was working fine.
Try to empty Infopah cache on client
How to do it more specifically depends on Windows and Infopath version/edition which were not given

Using SSIS Web Service Task with WCF

I am using SQL Server 2008 SSIS for importing data to the DB and .Net 3.5 SP1 for Creating the WCF service.
In the import task I am trying to use the Web Service Task to report to a WCF service.
At first I encountered a problem with the WCF WSDL, the Web Service task couldn't get their code generated from the metadata exposed by the WCF service. So I found a blog post at Christian Weyer's Blog
talking just about that.
Now after I can successfully load a WCF service to the Web Service Task and get the functions generated just fine from the WSDL I encountered another problem.
I get an error from the SSIS package at runtime saying that "Method 'ProxyNamespace.MyService.GetData' not found."
The full Error is:
Error: 0xC002F304 at Web Service Task False, Web Service Task: 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.MyService.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, VariableDispenser taskVariableDispenser)
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".
I know that the simple solution is going back to regular Web Service, but I really don't want to go there.
Thanks,
Omri.
Instead of using the SSIS web service task, maybe you can code it in a script task. You can use vb.net in 2005 - c# as well in 2008 I think.