Hi Sam,
You can use svcutil.exe to generate C# code. When you generate code using
svcutil, you can see the code is generated as you expected. I am attaching
the code I generated using svcutil for your reference.
Regards,
Shankar
On Tue, Mar 31, 2009 at 5:38 AM, Sam Carleton <[email protected]>wrote:
> I just created a .Net client to call the sample Calculator service that is
> in the Axis2/C source and it has the standard calling convention of:
>
> Calculator.addResponse add(Calculator.addRequest request);
>
> According to what I read in "Developing Web Services with Apache Axis2" by
> Kent Ka lok Tong, if the WSDL is correctly wrapped, the calling convention
> would be along these lines:
>
> int add(int param1, int param2);
>
> From what I can tell the WSDL is correctly wrapped. Is there something
> else I need to be doing? The way I am adding the reference to the C# code
> is by going to Service References, right clicking and selecting Add Service
> Reference, and finally giving it the wsdl:
> http://localhost:8042/axis2/services/Calculator?wsdl
>
> I have not changed anything about the Calculator service.
>
> Sam
>
--
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://ws.apache.org/axis2/services/Calculator",
ConfigurationName="CalculatorPortType")]
public interface CalculatorPortType
{
// CODEGEN: Generating message contract since the wrapper namespace
(http://ws.apache.org/axis2/services/Calculator/types) of message addRequest
does not match the default value
(http://ws.apache.org/axis2/services/Calculator)
[System.ServiceModel.OperationContractAttribute(Action="Calculator#add",
ReplyAction="*")]
addResponse add(addRequest request);
// CODEGEN: Generating message contract since the wrapper namespace
(http://ws.apache.org/axis2/services/Calculator/types) of message subRequest
does not match the default value
(http://ws.apache.org/axis2/services/Calculator)
[System.ServiceModel.OperationContractAttribute(Action="Calculator#sub",
ReplyAction="*")]
subResponse sub(subRequest request);
// CODEGEN: Generating message contract since the wrapper namespace
(http://ws.apache.org/axis2/services/Calculator/types) of message mulRequest
does not match the default value
(http://ws.apache.org/axis2/services/Calculator)
[System.ServiceModel.OperationContractAttribute(Action="Calculator#mul",
ReplyAction="*")]
mulResponse mul(mulRequest request);
// CODEGEN: Generating message contract since the wrapper namespace
(http://ws.apache.org/axis2/services/Calculator/types) of message divRequest
does not match the default value
(http://ws.apache.org/axis2/services/Calculator)
[System.ServiceModel.OperationContractAttribute(Action="Calculator#div",
ReplyAction="*")]
divResponse div(divRequest request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="add",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class addRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int param_1;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
public int param_2;
public addRequest()
{
}
public addRequest(int param_1, int param_2)
{
this.param_1 = param_1;
this.param_2 = param_2;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="addResponse",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class addResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int result;
public addResponse()
{
}
public addResponse(int result)
{
this.result = result;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="sub",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class subRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int param_1;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
public int param_2;
public subRequest()
{
}
public subRequest(int param_1, int param_2)
{
this.param_1 = param_1;
this.param_2 = param_2;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="subResponse",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class subResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int result;
public subResponse()
{
}
public subResponse(int result)
{
this.result = result;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="mul",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class mulRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int param_1;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
public int param_2;
public mulRequest()
{
}
public mulRequest(int param_1, int param_2)
{
this.param_1 = param_1;
this.param_2 = param_2;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="mulResponse",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class mulResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int result;
public mulResponse()
{
}
public mulResponse(int result)
{
this.result = result;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="div",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class divRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int param_1;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
public int param_2;
public divRequest()
{
}
public divRequest(int param_1, int param_2)
{
this.param_1 = param_1;
this.param_2 = param_2;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="divResponse",
WrapperNamespace="http://ws.apache.org/axis2/services/Calculator/types",
IsWrapped=true)]
public partial class divResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
public int result;
public divResponse()
{
}
public divResponse(int result)
{
this.result = result;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
public interface CalculatorPortTypeChannel : CalculatorPortType,
System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel",
"3.0.0.0")]
public partial class CalculatorPortTypeClient :
System.ServiceModel.ClientBase<CalculatorPortType>, CalculatorPortType
{
public CalculatorPortTypeClient()
{
}
public CalculatorPortTypeClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public CalculatorPortTypeClient(string endpointConfigurationName, string
remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public CalculatorPortTypeClient(string endpointConfigurationName,
System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public CalculatorPortTypeClient(System.ServiceModel.Channels.Binding
binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
addResponse CalculatorPortType.add(addRequest request)
{
return base.Channel.add(request);
}
public int add(int param_1, int param_2)
{
addRequest inValue = new addRequest();
inValue.param_1 = param_1;
inValue.param_2 = param_2;
addResponse retVal = ((CalculatorPortType)(this)).add(inValue);
return retVal.result;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
subResponse CalculatorPortType.sub(subRequest request)
{
return base.Channel.sub(request);
}
public int sub(int param_1, int param_2)
{
subRequest inValue = new subRequest();
inValue.param_1 = param_1;
inValue.param_2 = param_2;
subResponse retVal = ((CalculatorPortType)(this)).sub(inValue);
return retVal.result;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
mulResponse CalculatorPortType.mul(mulRequest request)
{
return base.Channel.mul(request);
}
public int mul(int param_1, int param_2)
{
mulRequest inValue = new mulRequest();
inValue.param_1 = param_1;
inValue.param_2 = param_2;
mulResponse retVal = ((CalculatorPortType)(this)).mul(inValue);
return retVal.result;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
divResponse CalculatorPortType.div(divRequest request)
{
return base.Channel.div(request);
}
public int div(int param_1, int param_2)
{
divRequest inValue = new divRequest();
inValue.param_1 = param_1;
inValue.param_2 = param_2;
divResponse retVal = ((CalculatorPortType)(this)).div(inValue);
return retVal.result;
}
}