473,786 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot Convert from ..CreditCardInf o to ..MyWebService. CreditCardI

Hello I have a BusinessClass CreditCardInfo defined in a library:
namespace Cockpit.Trackin gLibrary
{
/// <summary>
/// Summary description for OPCSignal.
/// </summary>
[Serializable]
public class CreditCardInfo
{
private string _number;
private int _expMonth, _expYear;

public string CardNumber
{
get { return _number; }
set { _number = value;}
}

public int ExpirationMonth
{
get { return _expMonth; }
set { _expMonth = value;}
}

public int ExpirationYear
{
get { return _expYear; }
set { _expYear = value;}
}
}

I have a webService using this BusinessClass as Parameter:
namespace Cockpit.Trackin gLibrary.wsOPCT ransmitter
[WebMethod()]
public void MakeDebit(Credi tCardInfo ccInfo, float amount)
{
// ... process the credit card ...
}
In the client I try to to call this Webservice:

srvOPCTransmitt er = new wsOPCTransmitte r.srvOPCTransmi tter();
// create an instance of the CreditCardInfo object
CreditCardInfo cc = new CreditCardInfo( );
cc.CardNumber = "11112222333344 44";
cc.ExpirationMo nth = 2;
cc.ExpirationYe ar = 2005;
srvOPCTransmitt er.MakeDebit (cc,4.95F);

but the compiler says at line with MakeDebit:
cannot convert from Cockpit.Trackin gLibrary.Credit CardInfo to
Cockpit.Trackin gLibrary.wsOPCT ransmitter.Cred itCardInfo
It seems it excpects the proxy class insted of the BusnissClass in the Web
Service Call!!!??

Waht is wrong?
Has anybody an example in C# with using an BusinessClass as Parameter in a
WebMethod?

Thanks
Seli
Nov 23 '05 #1
2 1478
Look at the generated proxy, use(if you use "Add web reference" from
within VS.Net, it's hidden .. so view all files .. expand the web
reference ), now for the services you'll have CreditCardInfot ype ,remove
the CreditCardInfo class definition in the proxy.. and replace all
intance of Cockpit.Trackin gLibrary.wsOPCT ransmitter.Cred itCardInfo to
Cockpit.Trackin gLibrary.Credit CardInfo in the proxy methods parameters.
BTW with .Net 2.0 you can use /sharedtypes to automatically enanble this.

regards
erymuzuan mustapa

Seli wrote:
Hello I have a BusinessClass CreditCardInfo defined in a library:
namespace Cockpit.Trackin gLibrary
{
/// <summary>
/// Summary description for OPCSignal.
/// </summary>
[Serializable]
public class CreditCardInfo
{
private string _number;
private int _expMonth, _expYear;

public string CardNumber
{
get { return _number; }
set { _number = value;}
}

public int ExpirationMonth
{
get { return _expMonth; }
set { _expMonth = value;}
}

public int ExpirationYear
{
get { return _expYear; }
set { _expYear = value;}
}
}

I have a webService using this BusinessClass as Parameter:
namespace Cockpit.Trackin gLibrary.wsOPCT ransmitter
[WebMethod()]
public void MakeDebit(Credi tCardInfo ccInfo, float amount)
{
// ... process the credit card ...
}
In the client I try to to call this Webservice:

srvOPCTransmitt er = new wsOPCTransmitte r.srvOPCTransmi tter();
// create an instance of the CreditCardInfo object
CreditCardInfo cc = new CreditCardInfo( );
cc.CardNumber = "11112222333344 44";
cc.ExpirationMo nth = 2;
cc.ExpirationYe ar = 2005;
srvOPCTransmitt er.MakeDebit (cc,4.95F);

but the compiler says at line with MakeDebit:
cannot convert from Cockpit.Trackin gLibrary.Credit CardInfo to
Cockpit.Trackin gLibrary.wsOPCT ransmitter.Cred itCardInfo
It seems it excpects the proxy class insted of the BusnissClass in the Web
Service Call!!!??

Waht is wrong?
Has anybody an example in C# with using an BusinessClass as Parameter in a
WebMethod?

Thanks
Seli

Nov 23 '05 #2
Hello Seli,

I believe you are trying to share types... refer the post titled "two
references to the same class in WebService client problem" in this news group

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hello I have a BusinessClass CreditCardInfo defined in a library:
namespace Cockpit.Trackin gLibrary
{
/// <summary>
/// Summary description for OPCSignal.
/// </summary>
[Serializable]
public class CreditCardInfo
{
private string _number;
private int _expMonth, _expYear;
public string CardNumber
{
get { return _number; }
set { _number = value;}
}
public int ExpirationMonth
{
get { return _expMonth; }
set { _expMonth = value;}
}
public int ExpirationYear
{
get { return _expYear; }
set { _expYear = value;}
}
}
I have a webService using this BusinessClass as Parameter:
namespace Cockpit.Trackin gLibrary.wsOPCT ransmitter
[WebMethod()]
public void MakeDebit(Credi tCardInfo ccInfo, float amount)
{
// ... process the credit card ...
}
In the client I try to to call this Webservice:

srvOPCTransmitt er = new wsOPCTransmitte r.srvOPCTransmi tter();
// create an instance of the CreditCardInfo object
CreditCardInfo cc = new CreditCardInfo( );
cc.CardNumber = "11112222333344 44";
cc.ExpirationMo nth = 2;
cc.ExpirationYe ar = 2005;
srvOPCTransmitt er.MakeDebit (cc,4.95F);
but the compiler says at line with MakeDebit:
cannot convert from Cockpit.Trackin gLibrary.Credit CardInfo to
Cockpit.Trackin gLibrary.wsOPCT ransmitter.Cred itCardInfo
It seems it excpects the proxy class insted of the BusnissClass in
the Web Service Call!!!??

Waht is wrong?
Has anybody an example in C# with using an BusinessClass as Parameter
in a
WebMethod?
Thanks
Seli

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
20623
by: Michel | last post by:
Hi again all, I have a small issue. Here's an example dataset : F1 F2 F3 1 0.58 Hi 2 0.70 Hello 3 Fail Bye 4 <Null> Hi
22
27899
by: Christoph Boget | last post by:
I am getting an error (a few among many) for the following lines of code: retval.BrokerName = (( curRow == System.DBNull.Value ) ? SqlString.Null : (string)curRow ); retval.BrokerGroupId = (( curRow == System.DBNull.Value ) ? SqlInt32.Null : (int)curRow ); The errors are (in turn):
12
10091
by: GRoll35 | last post by:
I get 4 of those errors. in the same spot. I'll show my parent class, child class, and my driver. All that is suppose to happen is the user enters data and it uses parent/child class to display it. here is the 4 errors. c:\C++\Ch15\Employee.h(29): error C2440: '=' : cannot convert from 'char ' to 'char '
2
15766
by: Christophe | last post by:
class A {} class B {} interface MyInterface { void method(A a); void method(B b); }
7
16717
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be returned from the source. My first attempt was as follows; (please ignore that error handling is not present in this example) public T GetValue<T(string objName) { T results;
6
30198
by: John | last post by:
The following code: int test = 1; bool isTrue = (bool)test; results in a compiler error: Cannot convert type 'int' to 'bool' wtf, any ideas on how to work around this?
1
5338
by: gdavid | last post by:
Hi. I Have started using Visual C++ 2008 a month ago. I Tried to make a GUI calculator but i cannot convert the textbox's text with the atof() function. The function cannot convert String^ type into a number. How can i convert from a String^ into c-string? Or how can i simple get the value of the textbox's text? By the way what kind of type String^ is? Please help me. Thanks. :-)
0
2704
by: =?Utf-8?B?VEQgaW4gUFNQ?= | last post by:
I've created a web service which I'm just running on my localhost development machine right now. If I open http://localhost/WebServices/MyWebService.asmx in IE everything works fine. However when I use it in a web project where it is declared in the ScriptManager section and then called in JavaScript it seems that it can't find it. In the aspx file within the <Servicessection of the <ScriptManagerI have: <asp:ServiceReference...
1
2638
by: Cezus | last post by:
Hello, I cannot convert the following query in the dataset to a string. It says it cannot get more then 2034 chars long... the string just ends at 2034 characters... this is where it goes wrong in the code: string xml = Convert.ToString(mijnQTA.GetDataXMLForAuto());
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.