Calling a RDBMS Web Service Made in XML GAteways with C#

Hi We made some Web Services using XML GATEWAYS using the RDBMS adapter.

The Web Services are target Webservices because they only update or insert information.

But we can not call those web services using C#.

Can anyone helpus with this.

Thanks a lot.

Carlos

Hi Carlos,

“Unable to call from C#” is a very general statement.

If you could post the error you receive I could probably say more.

To cover some of the more common errors you should know the following:

The XML Gateways SOAP interface is based on the AXIS engine from Apache so you should make sure of that the C# client adds a SOAPAction to the HTTP header. AXIS is very dependent on this.

The XML Gateways supports MIME but not DIME (a favorite of Microsoft). Make sure your client is creating MIME formatted messages.

Regards,

Hi Matthew

Thanks for your answer.

I will send you the C# code that invokes the web service and the WSDL of the web service.

The error is that the Web service do get to be called.

If a try to executed via HTTP i get the following errors

Execute
http://meganeii:8080/fraxis/services/WS_SP_SAGPRIORIZARDIFERIDO?method=MessageDefinition&NUMPEDTOPAS=W00025&FRANQUICIA=B
javax.resource.ResourceException: invalid next child “‘FRANQUICIA’ (no namespace URI)” for row MessageDefinition expected name to be: ‘NUMPEDTOPAS’ (no namespace URI); nested exception is:
com.softwareag.fresno.base.document.DocumentException

Execute
http://meganeii:8080/fraxis/services/WS_SP_SAGPRIORIZARDIFERIDO?method=MessageDefinition&NUMPEDTOPAS=W00025

javax.resource.ResourceException: StmtMapField.setObject Field Number <2> - null input value for required parameter.; nested exception is:
com.softwareag.fresno.resourceadapter.managed.ManagedAdapterException: StmtMapField.setObject Field Number <2> - null input value for required parameter.

We try to do this because we want to executed using HTTP, because the SOAPCLient in C# dont work.

Thanks a lot for your help.

Carlos
Webservice.zip (1.65 KB)

Hi Carlos,

Being the inexperienced c# programmers we are, we are still looking for a way for you to call the Web Service using c#.

In the meantime, it is probably also helpful for you to know that you the way you are calling the web service is not supported. From the logs posted so far, it looks like you are using the http get method, placing the information required by the Web Service in the request URL.

The Web Service is expecting a document literal SOAP message however which should be "post"ed to the URL of the service.

I don’t have a complete Visual Studio installed at this time so it might take a while to get you an example of how it should work…

If I have the chance to do this, I’ll let you know.

Regards,

Hi Carlos,

We were able to create a c# program that calls a document literal style web service without too many problems.

The c# program is actually quite simple but requires that you add the wsdl file of your web service to integrate as a WebReference in you c# project.

To get your web service call working, you should begin by creating a C# Console Application Project (called Example below). Once that is done, add your web service as a WebReference to the project.

Once the WebReference is added you can then write the c# program to call your service. In the following example, I used a web service URL of http://pcmaga5/services/EELIB?wsdl to import the Web Reference.

using System;
using System.Collections.Generic;
using System.Text;

namespace Example
{
class Program
{
static void Main(string args)
{

        pcmaga5.EELIB ee = new pcmaga5.EELIB();

        pcmaga5.EEODEN01 eeoden = new pcmaga5.EEODEN01();

        eeoden.ENGLISHNAME = "Jonathan"; 

        ee.Enquiry(eeoden);

        Console.WriteLine(eeoden);
    }
}

}

All this does is create an instance of the Service and operation. It then sets the value of one of the XML nodes to Jonathan and sends it.

I hope this helps you some.

Kind Regards,

Hi i was able to create adapt the proxy class generated by Visual Studio to call the Web Service the XML Gateways had generate.

Here is the source code.

Thanks for all your help and i hope this can help others to.

Regards

Carlos Abad

using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
using System.Configuration;

///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“code”)]
[System.Web.Services.WebServiceBindingAttribute(Name=“WS_SP_SAGPRIORIZARDIFERIDOSoapBinding”, Namespace=“”)]
public class PriorizarDiferidoT : System.Web.Services.Protocols.SoapHttpClientProtocol
{

/// <remarks/>
public PriorizarDiferidoT() 
{
	//this.Url = "http://meganeii:8080/fraxis/services/WS_SP_SAGPRIORIZARDIFERIDO";
	this.Url=ConfigurationSettings.AppSettings["urlWS"];
}

/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("MessageDefinition", Namespace="")]
public object MessageDefinition(string NUMPEDTOPAS, string FRANQUICIA, string REFERENCIA) 
{
	object[] results = this.Invoke("MessageDefinition", new object[] {NUMPEDTOPAS,FRANQUICIA,REFERENCIA});
	return ((object)(results[0]));
}  
/// <remarks/>
public System.IAsyncResult BeginProcessDocument(object ProcessDocument1, System.AsyncCallback callback, object asyncState) 
{
	return this.BeginInvoke("ProcessDocument", new object[] {
																ProcessDocument1}, callback, asyncState);
}

/// <remarks/>
public object EndProcessDocument(System.IAsyncResult asyncResult) 
{
	object[] results = this.EndInvoke(asyncResult);
	return ((object)(results[0]));
}

}