TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kasukurthi kishore
NA
1
5k
Wanna call tibco webservice to .net plz help me
Mar 14 2012 4:30 PM
Hi
i had a wsdl in xml format just adding of two numbers with fault message
i had saved the wsdl file and used the wsdl.exe for genration of proxy class
i got 2 files which one is .cs file and .config files
i had opened a vs 2008 and click on webservice template and taken name as WSExample affter tht i copied that .cs file and app.config file into this webservice this looks like this
.cs file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
//
// This source code was auto-generated by wsdl, Version=2.0.50727.1432.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "SamplePortTypeEndpoint1Binding", Namespace = "http://xmlns.example.com/1331492986812")]
public partial class SampleWSDLservice1 : System.Web.Services.Protocols.SoapHttpClientProtocol
{
private System.Threading.SendOrPostCallback OperationOperationCompleted;
/// <remarks/>
public SampleWSDLservice1()
{
this.Url = "http://localhost:8565/Practice/Process/SampleWSDL-service1.serviceagent/SamplePor" +
"tTypeEndpoint1";
}
/// <remarks/>
public event OperationCompletedEventHandler OperationCompleted;
[WebMethod]
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("/Practice/Process/SampleWSDL-service1.serviceagent/SamplePortTypeEndpoint1/Operat" +
"ion", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
public void Operation([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.tibco.com/schemas/SampleSchema.xsd")] ref Request Request)
{
object[] results = this.Invoke("Operation", new object[] {
Request});
Request = ((Request)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginOperation(Request Request, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("Operation", new object[] {
Request}, callback, asyncState);
}
/// <remarks/>
public void EndOperation(System.IAsyncResult asyncResult, out Request Request)
{
object[] results = this.EndInvoke(asyncResult);
Request = ((Request)(results[0]));
}
/// <remarks/>
public void OperationAsync(Request Request)
{
this.OperationAsync(Request, null);
}
/// <remarks/>
public void OperationAsync(Request Request, object userState)
{
if ((this.OperationOperationCompleted == null))
{
this.OperationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOperationOperationCompleted);
}
this.InvokeAsync("Operation", new object[] {
Request}, this.OperationOperationCompleted, userState);
}
[WebMethod]
private void OnOperationOperationCompleted(object arg)
{
if ((this.OperationCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.OperationCompleted(this, new OperationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState)
{
base.CancelAsync(userState);
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.tibco.com/schemas/SampleSchema.xsd")]
public partial class Request
{
private string firstNumberField;
private string secondNumberField;
private string finalResultField;
private string faultField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(DataType = "integer")]
public string FirstNumber
{
get
{
return this.firstNumberField;
}
set
{
this.firstNumberField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(DataType = "integer")]
public string SecondNumber
{
get
{
return this.secondNumberField;
}
set
{
this.secondNumberField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(DataType = "integer")]
public string FinalResult
{
get
{
return this.finalResultField;
}
set
{
this.finalResultField = value;
}
}
/// <remarks/>
public string Fault
{
get
{
return this.faultField;
}
set
{
this.faultField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void OperationCompletedEventHandler(object sender, OperationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class OperationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal OperationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public Request Request
{
get
{
this.RaiseExceptionIfNecessary();
return ((Request)(this.results[0]));
}
}
}
.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SamplePortTypeEndpoint1Binding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8565/Practice/Process/SampleWSDL-service1.serviceagent/SamplePortTypeEndpoint1"
binding="basicHttpBinding" bindingConfiguration="SamplePortTypeEndpoint1Binding"
contract="SamplePortType" name="SamplePortTypeEndpoint1" />
</client>
</system.serviceModel>
</configuration>
i run the service file its works fine by giving a function name
operation
i clicked on the service description link and taken the url copied and pasted in a notepad
after that i had opened a client application and designed that .aspx
opened the aspx.cs fie and added the webreference by taken tht url which was pasted in the notepad
and clicked on go button
its works fine i got operation(firstname integer,lastname integer,finalresult ineteger,fault as string)
i had renamed the web reference name and click on ok
my .aspx.cs looks like
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
//using System.Reflection.MethodInfo;
using SampleOp;
public partial class _Default : System.Web.UI.Page
{
SampleWSDLservice1 obj1 = new SampleWSDLservice1();
Request objr = new Request();
//OperationCompletedEventArgs OCE = new OperationCompletedEventArgs();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
objr.FirstNumber=TextBox1.Text;
objr.SecondNumber=TextBox2.Text;
(((((((((((((( TextBox3.Text=obj1.Operation(out Request);
// TextBox4.Text=;
//objr.FinalResult = obj1.Operation();
//TextBox3.Text = objr.FinalResult.ToString();
//TextBox4.Text=objr.Fault;)))))))))))))))))))
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
}
}
my problem is:
how to write code to textbox1.text,textbox2.text,textbox3.text,textbox4.text
plz help meeeeeeeeeee
in my process is anything wrong suggest me
Hoping the reply as soon as possible
Thank Q
Reply
Answers (
0
)
How to return in a method before transaction?
How to call C# methods in window service?