|
I posted on here recently about this but I am still none the wiser so again I come seekign advice.
I have a web service and a website consuming this service. I would like to pass a custom class from the website to the webservice and vice versa.
The trouble is every time it gives me a error message saying
"type is not the same as loclahost.Type"
How can I get them to agree that it the same type?
I have built a VERY basic example of what I am trying to which can be found here: WS passing cutom class.zip
If anyone can help at all then I would be very appreciative.
|
|
|
|
|
Define the type in the web service. Use that type, as defined in the web service, in your code, don't create a new class of the same name.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
There is a large amount of work with the custom class before and after the web service call which would make it very hard to use the type webservicename.type
Also I am trying to create a web services approach with my current apparoach as a back up which would make it very hard to use webservicename.type.
|
|
|
|
|
From the error it seems you defined the class in your code TWICE. You can't do that. You simply have no choice but to define it once and use that class in both your webserver and client projects. As it stands now, both of your applications are saying that they have the proper definition of the class, even though they are exactly the same code, they're not the same class.
|
|
|
|
|
After a very quick look at your example I believe you need:
Dim Person As New localhost.Simple
Dim Proxy As localhost.Service
Person = Proxy.Returnnames(Person)
instead of
Dim Person As New Eurofins.Simple
Dim Proxy As localhost.Service
Person = Proxy.Returnnames(Person)
My thought on this being that a proxy class of type 'Simple' should have been created when you made a reference to the webservice. These generated proxy classes are marked up with alot of Soap attributes that make everything work. If you are referencing another class with the name of Simple instead of the generated proxy class I can understand why you would get errors because localhost.Service is expecting a class within it's namespace. You can actually navigate to the proxy class code through the object browser if you double click on the web reference.
Also it is possible to do this without a web reference and create your own proxy class (or the gerated one and modify it) if that is what you want or need. Here's a sample from my code using xml serialization, actual classes not included.
private UserInformation GetUserInfoFromWebService(Uri ServiceUri)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ServiceUri);
request.Method="GET";
request.Credentials = CredentialCache.DefaultCredentials;
request.ContentType="application/x-www-form-urlencoded";
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
XmlSerializer UserInfoSerializer= new XmlSerializer(typeof(UserInformation),"http://localhost/UserServices/");
Stream responseStream = response.GetResponseStream();
StreamReader responseReader = new StreamReader(responseStream);
UserInformation UserInfo = (UserInformation)UserInfoSerializer.Deserialize(responseReader);
responseStream.Close();
response.Close();
return UserInfo;
}
Hope this helps.
-- modified at 11:12 Monday 21st May, 2007
-- modified at 11:14 Monday 21st May, 2007
topcoderjax
|
|
|
|
|
Hi! again.
can anyone tell me how to find a specific data Like Name by using ID from a Microsoft Data Base(MS ACCESS DATABASE).(I'm Using Microsoft Visual Basic 2005 Express Edition)
Ex:
ID Name
01 John
02 Smith
I want the Name of the specific ID to come into a textbox.
(If I say Find "01" then John Should Be loaded into Textbox1)
(I been Searching Google and I can't find any simple codes)
7-9 lines of codes is preferable because I'm new to Database
Any Help will be greatly Appreciated.
(Sorry For any inconvenience that have I caused in the past)
|
|
|
|
|
If database is ms-access
imports system.data.oledb
dim con as new oledbconnection("Connection String")
con.open
dim cmd as new oledbcommand("select name from tablename where id=1",con)
dim dr as oledbdatareader=cmd.executerreader()
if(dr.read)
textbox1.text=dr.item("name").tostring()
end if
|
|
|
|
|
thank you very very much.
|
|
|
|
|
Hi ,
I need some help.. in VB.Net how can we insert into combobox or textbox placed in a datagrid? What is the coding part in vb.net? how can we proceed?
Please Help me as possible
|
|
|
|
|
in vb.net 2003?
I was using flexgrid(vb6 control) in 2003.In the form i drag droped a combo box also.then on the cell click i am making that combobox visible right at in that cell.
for that i wote the following code.
Private Sub flxGrid_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles flxgrid.ClickEvent
Dim xPos, yPos As Integer
Try
grdCol = flxgrid.Col
grdRow = flxgrid.Row
cmbChange.Visible = False
cmbChange.Width = CInt(0.068 * flxgrid.CellWidth)
cmbChange.Height = CInt(0.068 * flxgrid.CellHeight)
xPos = (flxgrid.Location.X + CInt(0.068 * flxgrid.get_ColPos(flxgrid.Col))) - 2
yPos = (flxgrid.Location.Y + CInt(0.068 * flxgrid.get_RowPos(flxgrid.Row))) '((flxGrid.Row + 1) * 20))
cmbChange.Left = xPos
cmbChange.Top = yPos
' m_ObjClsGeneral = New Generic.clsGeneral(gStrConn)
If flxgrid.Col = 2 Then ''For Actual Shift
Call FillShifts()
cmbChange.Visible = True
ElseIf flxgrid.Col = 3 Then ''For Status
Call FillStatus()
cmbChange.Visible = True
End If
End Sub
-- modified at 5:46 Monday 21st May, 2007
|
|
|
|
|
You're question isn't very clear. I can think of three different meanings with the way it's worded. Try these[^] to see if any of them are what you're trying to say.
|
|
|
|
|
Hi,
Is there any event that handles anykind of changes done on clipboard
Thanks in advance
Parag Gupta
|
|
|
|
|
please explain a little bit more.
|
|
|
|
|
No, I don't believe there's an event fired when the clipboard changes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Private System.Collections.ArrayList m_workSocketList=ArrayList.Synchronized(New System.Collections.ArrayList())
Socket workerSocker=m_mainSocket.EndAccept
Above is c# code,who can converted to vb.net code.thanks
|
|
|
|
|
|
|
braleping wrote: Above is c# code
No, it's not.
---
single minded; short sighted; long gone;
|
|
|
|
|
This isn't C# code. The first line can be interpreted as VB.NET code, but not the second line.
|
|
|
|
|
can i programatically calculate the meaning of %USERPROFILE% FROM
%USERPROFILE%\My Documents\Visual Studio 2005\Projects
|
|
|
|
|
You could use Environment.SpecialFolder to get the My Documents folder for the current user.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That means %User Profile% is realted to current user?
|
|
|
|
|
I would presume so.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
%UserProfile% is an environment variable. Open a CMD prompt and type SET USERPROFILE and it'll show you what's it's current value is. If you want to to resolve that name, just use the Environment.GetEnvironmentVariable() method.
|
|
|
|