Ok, solved it.
I want to send the following back as a result from the webservice to the application but get told it's not allowed as it's not a string:
Entity.quotenum
Entity.Company name
Return Entity
How can i achieve this?
you need to return Entity, assuming Entity is an object.
so instead of:
public string SomeMethod() { .. }
the signature should be:
public Entity SomeMethod() { .. }
its all to do with the return type in this case. Entity would not be a string but an object of type - you guessed it - Entity
Erm, ok. i get that, but where does it go? i'm using the following at the mo: Public How do i return it? Return Svc1 ? Apologies if it's simple but i can't find anything on this
Is it just the same?
to me, that code there is telling me you are returning back Calculator.ServerDocResult, correct?
SVC1 is the NAME of the function, not the return type.
so I guess....
public function Svc1(ByVal DocumentName As String) As Calculator.ServerDocResult
'Do stuff here with ServerDocResult object
return theServerDocResult
End function
have you ever developed in VB.NET? It's the same for webservices (to a certain extent I guess). :-)
so if I had a class called "Person". a Person has many attributes (properties)
if I wanted to return "A person" back to the caller from the webservice:
public function DoGetMeAPerson(string thePersonName) As Person
Dim thePerson as New Person()
thePerson.Name = thePersonName
return thePerson
end function
simple example, simple OO example I guess.
in the webservice, you are creating a person object and giving this person a name, then returning this person object.
The same would apply for your ServerDocResult.
does this help make things clearer?
any errors?
At what part does it time out?
Code from either end (caller and webservice) would be better for us to assist you
Here's the web service code i use:
<WebMethod()> _
Public Function DocumentSvc1(ByVal DocumentName As String, ByVal Entities As Calculator.Entity) As ServerDocResultDocumentSvc1.EmailTo = S@s.com
DocumentSvc1.Name = "SR"
Return DocumentSvc1
End Function
And for the application: Dim Entity As New StevesWebSvcTest.uk.co.<domain>.www.Entity Private
Entity.CompanyName = "Seegfe"
Entity.ContactName = "Steve"
Label1.Text = Submit.B3DocumentSvc1("ServerDoc1", Entity).EmailFromAddress End Sub
It times out on the Label1.Text part.
Please use wsdl.exe tool to generate the client ofr your webservice:
wsdl.exe http://hostname/service.asmx /language:vb
It willl generate a vb wrappes to call the service, compile the code into your client app, and use it.
Thanks,
Elena