Skip to main content

Microsoft Silverlight

Unanswered Question Calling webservice - Protocolexception - 404RSS Feed

(0)

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Calling webservice - Protocolexception - 404

I'm trying to access a webservice in my silverlight project. The webservice works fine, calling the webservice with different parameters gives me exactly the result I want, but with this set of parameters, I get a "ProtocolException was unhandled by user code" "The remote server returned an unexpected response (404) Not Found".

Setting a breakpoint in the service, I see there's indeed nothing wrong with the service, the breakpoint gets hit, and the right response is returned. After googling a bit on the subject, a possible reson might be the length of the response. So I modified the web.config to include:

 <binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<
readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /></binding>

And of course I set my bindingconfiguration to this. Still the same problem though. I tried using the web development helper to see what's going on, but this plugin throws a .NET exception:

 ************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at nStuff.WebDevHelper.UserInterface.HttpTools.HttpLogConsole.ProcessNewItems()

So no help there either. Does anyone have any suggestions left about what's wrong here?

 

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Calling webservice - Protocolexception - 404

1) Are you doing cross-domain call? If yes, have you updated your clientaccesspolicy file?

2) If you do not think it is cross-domain call. Have you checked url for the endpoint of your service in your ServiceReference.ClientConfig file? Is the Port# in that url the same as the port# in your page url? Or you set the Service URL in your code?

3) Did you get the error only when you trying to send large data back to your WebService? If not, your LargeBuffer binding change won't help you. If yes, take a look at this thread. Follow the steps I posted in my last post there to config your Web.config and ServiceReference.ClientConfig file:

http://silverlight.net/forums/p/18466/63010.aspx#63010

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Calling webservice - Protocolexception - 404

Still no luck, the 2nd time my webservice gets called, it still fails. It's no cross-domain call, and it's no port problem, because in that case the first call would have failed as well. I've modified the ClientConfig like you suggested, but still the same problem :(

SteveWong
SteveWong

Contributor

Contributor

6343 points

1,281 Posts

Re: Re: Calling webservice - Protocolexception - 404

 can you paste your clientaccesspolicy.xml and the web.config and ServiceReference.ClientConfig here?

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

Client App Dev

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Calling webservice - Protocolexception - 404

klukkluk:

Still no luck, the 2nd time my webservice gets called, it still fails. It's no cross-domain call, and it's no port problem, because in that case the first call would have failed as well. I've modified the ClientConfig like you suggested, but still the same problem :(



What do you mean by "the 2nd time my webservice gets called"? So you have it working, but only on every first try? If you can ever get it working, then it is not cross-domain issue nor is configuration issue. Are every time you calling the same method and passing the same data?

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

lewisb
lewisb

Member

Member

217 points

82 Posts

Re: Calling webservice - Protocolexception - 404

Is the first call to the webservice passing/returning a some primative data type(s) and the second call using some complex data type?  If so, there may be some sort of serialization error.

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Calling webservice - Protocolexception - 404

@SteveWong:

 I don't have a clientaccesspolicy file, this is my clientconfig:

 <configuration>
<
system.serviceModel>
<
client>
<
endpoint address="http://localhost:58139/MasterDetail.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_MasterDetail" contract="SLWeb.ServiceReference.MasterDetail"
name="BasicHttpBinding_MasterDetail" />
</
client>
<
bindings>
<
basicHttpBinding>
<
binding name="BasicHttpBinding_MasterDetail" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<
security mode="None" />
</
binding>
</
basicHttpBinding>
</
bindings>
</
system.serviceModel>
</
configuration>

 @sladapter:

Yes, I have the webservice working, but only with a certain set of 'request' parameters. With a 2nd set, a different response is returned. And this one fails.

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Calling webservice - Protocolexception - 404

klukkluk:

Yes, I have the webservice working, but only with a certain set of 'request' parameters. With a 2nd set, a different response is returned. And this one fails.

 

What is your second set of parameter that not working? Could you show your the WebService function signature?

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

lewisb
lewisb

Member

Member

217 points

82 Posts

Re: Calling webservice - Protocolexception - 404

Also, what are the return types of both calls?  Bool, int, some complex object?

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Calling webservice - Protocolexception - 404

The return type of my webmethod is a complex type.

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Calling webservice - Protocolexception - 404

You tagged all your complex type of data as [DataContract]? You sure it's not a serialization problem?

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Calling webservice - Protocolexception - 404

I am having similiar issues, only mine isn't intermittant - I get the 404 error on the first try every time -  via webDevelopmentHelp I get a 404 status on URL - http://ws.cdyne.com/clientaccesspolicky.xml - here is my clientaccesspolicy.xml file.

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

 

mb

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Calling webservice - Protocolexception - 404

mebjen,

Check your clientaccesspolicky.xml file name. it should be clientaccesspolicy.xml. 

Where did you put your clientaccesspolicy.xml file? At inetput\wwwroot?

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Calling webservice - Protocolexception - 404

sladapter,

good catch - that was just a typo on my end. I went back and checked - it is clientaccesspolicy.xml. Yes, my clientaccesspolicy is located  in C:\Inetpub\wwwroot

Also, I should mention that this serviceReference worked great in SL2B1 -

mb

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Calling webservice - Protocolexception - 404

Check the url for your service end point in your ServiceReferences.ClientConfig.

Show us the code you make your WebService call.

Also make sure you are running in http mode not in File mode. (check your page url when you run your page)

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Re: Calling webservice - Protocolexception - 404

sladapter,

serviceReference.ClientConfig - endPoint

<client>
     
<endpoint address="http://ws.cdyne.com/emailverify/emailvernotestemail.asmx"
      
binding="basicHttpBinding" bindingConfiguration="EmailVerNoTestEmailSoap"
       
contract="cdyneSerRef.EmailVerNoTestEmailSoap" name="EmailVerNoTestEmailSoap" />
</
client>

code to call webService -

Dim mailIn As String
mailIn = txtBxeMail.Text
verEmail.VerifyEmailAsync(mailIn, strLiscenseKey)
AddHandler verEmail.VerifyEmailCompleted, AddressOf verEmail_Completed

yes - diffently running in http mode -

 

mb

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

sladapter,

I should have include:

Public cdyneBind As New BasicHttpBinding

Public cdyneEndPoint As New EndpointAddress("http://ws.cdyne.com/emailverify/emailvernotestemail.asmx")

Private verEmail As New cdyneSerRef.EmailVerNoTestEmailSoapClient(cdyneBind, cdyneEndPoint)

 

Dim mailIn As String
mailIn = txtBxeMail.Text
verEmail.VerifyEmailAsync(mailIn, strLiscenseKey)

AddHandler verEmail.VerifyEmailCompleted, AddressOf verEmail_Completed

 

mb

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

1) You should change the order of your call. Add serviceCompleted event handler before you call the service. Otherwise your code won't hit Service completed event handler code.  (this change won't fix your 404 error)


AddHandler verEmail.VerifyEmailCompleted, AddressOf verEmail_Completed

verEmail.VerifyEmailAsync(mailIn, strLiscenseKey)

2) I saw you put the URL in the code and create binding in the code, so you are by-passing the ClientConfig reading. That is OK. We do not have to worry about what's in the ClientConfig in this case.

3) Is "ws.sdyne.com" the server you put your clientaccesspolicy.xml file?

4) What is the size of your mailIn string? Could it be greater than 8200 chars?

 

 

 


 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

sladapter,

1 - OK // but prior to sl2b2 when everything was working, during debug I was able to 'step-into' all aspects of this related code - in fact, it does hit service completed event handle code because that is where other events fire and if it didn't reach service completed - I would have other issues to address.

2- . . . .

3 - ws.cdyne.com is the web service - http://ws.cdyne.com

4 - mailin is just you typical email address (someone@somewhere.com)

 

 

mb

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

 Everything should be fine then. Can you access http://ws.cdyne.com/clientaccesspolicy.xml by putting the URL in the browser?

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

sladapter,

I wish everything was fine - yes, I access by putting the URL in the browser.  I still get the ProtocolException - The remote server returned an unexpected response: (404) Not Found. Highlighting/pointing at _result.  This function is in Reference.vb

Public Function EndVerifyEmail(ByVal result As System.IAsyncResult) As cdyneSerRef.ReturnIndicator Implements cdyneSerRef.EmailVerNoTestEmailSoap.EndVerifyEmail

Dim _args((0) - 1) As Object

Dim _result As cdyneSerRef.ReturnIndicator = CType(MyBase.EndInvoke("VerifyEmail", _args, result),cdyneSerRef.ReturnIndicator)

Return _result

End Function

mb

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Hi, I feel your pain. I just don't have any new clue on where the problem could be. Is it possible to put the Service code under your Web project so you can make non cross-domain call to see if it is working? You want to make sure it is not a cross-domain issue first before you calling the remote service.

 

 

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

OK - this has been an all day hair-puller.  I've noticed from all my searches that others are or have had similar problems - but I'm not seeing any definitive answers.  So - I thought I would try and create a 'new/fresh' sl2b2 project and add a serviceReference - to test.  After I had my cdyne reference (http://ws.cdyne.com/emailverify/emailvernotestemail.asmx) named cdyneServRef - and the following one line of code:

Private verEmail As New cdyneServRef.EmailVerNoTestEmailSoapClient

It builds without error / but I get the following Error - when I try and run it.

System.InvalidOperationException was unhandled by user code
  Message="ConfigUnrecognizedElement"
  StackTrace:
       at System.ServiceModel.Configuration.BindingsSection.ReadXml(XmlReader reader)    at System.ServiceModel.Configuration.ServiceModelSectionGroup.ReadXml(XmlReader reader)    at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()    at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Current()    at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)    at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)    at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)    at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)    at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)    at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)    at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()    at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()    at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)    at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()    at System.ServiceModel.ClientBase`1..ctor()    at sl2b2_webServiceTest.cdyneServRef.EmailVerNoTestEmailSoapClient..ctor()    at sl2b2_webServiceTest.Page..ctor()    at sl2b2_webServiceTest.App.Application_Startup(Object o, StartupEventArgs e)    at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)    at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
  InnerException:

 


 

mb

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Well, I still haven't solved my issue either.

Is there a way to check if the response from my webservice gets serialized properly?

skm.software@yahoo.com
skm.soft...

Member

Member

196 points

216 Posts

Re: Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Hi,

There is simple solution if every function working fine in your's service code, or sometime this error may be also due to some database error.

Try the following

Delete the service refrence file from the project.

Create a new service reference file with same name(i.e of deleted)

and run the application again,

Sachin Mukhija 

Sachin Mukhija
"Please Mark as answer if answer is correct".

skm.software@yahoo.com
skm.soft...

Member

Member

196 points

216 Posts

Re: Calling webservice - Protocolexception - 404

Hi,

There is simple solution if every function working fine in your's service code, or sometime this error may be also due to some database error.

Try the following

Delete the service refrence file from the project.

Create a new service reference file with same name(i.e of deleted)

and run the application again,

Sachin Mukhija 

Software Engineer

 

Sachin Mukhija
"Please Mark as answer if answer is correct".

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Calling webservice - Protocolexception - 404

Hi Sachin,

I actually started a new SL2B2 project, here are the steps I took:

  1. Chose create new project -
  2. Chose - Add a new Web to the solution for hosting
  3. Under Services - RtClicked and chose Add ServiceReference
  4. Add the following lines of code:

Public strLiscenseKey As String = "xxxxxx-x-x-xxxxxx-xxxx--xxxxxxx"
Public cdyneBind As New BasicHttpBinding
Public cdyneEndPoint As New EndpointAddress(http://ws.cdyne.com/emailverify/emailvernotestemail.asmx)
Private verEmail As New cdyneServRef.EmailVerNoTestEmailSoapClient(cdyneBind, cdyneEndPoint)

In this SL app there is 1 textBox and 1 button:

Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnSubmit.Click
  Dim mailIn As String
  mailIn = txtBx_email.Text
  Cursor = Cursors.Wait
  AddHandler verEmail.VerifyEmailCompleted, AddressOf verEmail_Completed
  verEmail.VerifyEmailAsync(mailIn, strLiscenseKey)
End Sub

Private Sub verEmail_Completed(ByVal sender As Object, ByVal e As cdyneServRef.VerifyEmailCompletedEventArgs)
   Dim myMsg As String
   Dim vm As Boolean
   vm = e.Result.GoodEmail
     If vm = True Then
       txtBx_email.Text = "email OK"
       Cursor = Cursors.Arrow
    Else
      txtBx_email.Text = "invalid email"
      Cursor = Cursors.Arrow
   End If
End Sub

Ok, so that's it - now when I run it - I receive the following error after a btnClick -

System.ServiceModel.ProtocolException was unhandled by user code
  Message="The remote server returned an unexpected response: (404) Not Found."
  StackTrace:
       at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)    at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)    at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)    at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)    at sl2b2_webServiceTest.cdyneServRef.EmailVerNoTestEmailSoapClient.EmailVerNoTestEmailSoapClientChannel.EndVerifyEmail(IAsyncResult result)    at sl2b2_webServiceTest.cdyneServRef.EmailVerNoTestEmailSoapClient.cdyneServRef_EmailVerNoTestEmailSoap_EndVerifyEmail(IAsyncResult result)    at sl2b2_webServiceTest.cdyneServRef.EmailVerNoTestEmailSoapClient.OnEndVerifyEmail(IAsyncResult result)    at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
  InnerException:

 

 

 

mb

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Calling webservice - Protocolexception - 404

Sachin,

 Already tried that...

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

mebjen:

OK - this has been an all day hair-puller.  I've noticed from all my searches that others are or have had similar problems - but I'm not seeing any definitive answers.  So - I thought I would try and create a 'new/fresh' sl2b2 project and add a serviceReference - to test.  After I had my cdyne reference (http://ws.cdyne.com/emailverify/emailvernotestemail.asmx) named cdyneServRef - and the following one line of code:

Private verEmail As New cdyneServRef.EmailVerNoTestEmailSoapClient

It builds without error / but I get the following Error - when I try and run it.

System.InvalidOperationException was unhandled by user code
  Message="ConfigUnrecognizedElement"

 

 

mb,

I know this error. This error is caused by some invalid tag in your ClientConfig file. 

Check your ClientConfig file to see if you have a Tag called CustomBinding? For some reason if your service is asmx service,  when creating a ServiceReference, VS put this CustomBinding tag into the ClientConfig file. But it is neither used nor it's a valid. At least 2 people already had this probelm. Just remove that tag should make this error go away.

I don't know if anybody has already reported this bug or not. You can try to report it in the Bug forum if you find this is the case.

See this Rui-Marinho 's problem in this thread: http://silverlight.net/forums/p/17500/60453.aspx#60453

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mebjen
mebjen

Member

Member

82 points

99 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

OK - after a day and half and working closely w/sladapter, we were able to figure out the problem.  CDYNE is a public webService used for checking the validity of an email address.  In SL2B1 everything worked fine - its wasn't until SL2B2 that the problems appeared. It was because the neither the clientaccesspolicy file nor the crossdomain file had been updated to reflect the minor policy changes in SL2B2. Once CDYNE updated the files the ProtocolException-404 went away.  Bottom line, if you are using a public web service - make sure there policy files are updated to support SL2B2.

mb

peterralphylee
peterral...

Member

Member

21 points

11 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Hi, I am also having a problem with the 404 error....basically I am trying to implement sladapter's solution to displaying a dataset in my datagrid (found here: http://silverlight.net/forums/p/16733/69252.aspx#69252) as I need to display dynamic data that I will not always know the exact structure for, therefore this solution is perfect, apart from I am writing it in vb. Now everything appears to be working absolutely fine and I have converted it into vb nicely and I can see the results when I put it into debug, but as soon as I try to pass my result within the object over my silverlight wcf service to my code behind the xaml it hits the 404 error in my reference.vb. I have tried all of the solutions suggested in this thread, but with no success, does anybody have any other suggestions please?

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

When you say everything is working fine does that mean you get the data displayed? So you already had the data coming from WCF service working, right? When do you get 404 error?

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

peterralphylee
peterral...

Member

Member

21 points

11 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Thanks for the speedy reply! I can see the data populating the object that I create within my web service.svc.vb, I'm stepping through it with debug watching it populate, but as soon as it tries to return the result from the service to the silverlight it gets stuck in the transfer and throws up the 404 error. It happens in my Reference.vb in this function:

 

Public Function EndGetOneRecCRMTable(ByRef CRMTableName As String, ByRef ErrorStr As String, ByVal result As System.IAsyncResult) As Object Implements ServiceReference1.SLService.EndGetOneRecCRMTable

Dim _args((2) - 1) As Object

_args(0) = CRMTableName

_args(1) = ErrorStr

Dim _result As Object = CType(MyBase.EndInvoke("GetOneRecCRMTable", _args, result),Object)

CRMTableName = CType(_args(0),String)

ErrorStr = CType(_args(1),String) Return _result

End Function

 

it always highlights the object at the end of this line: Dim _result As Object = CType(MyBase.EndInvoke("GetOneRecCRMTable", _args, result),Object)

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

So you are hitting the service that means it's not a connection problem. The problem is when you trying to return the data. What data you are trying to return? I assume you are trying to return a DataSetData back since you said you are using my demo code.  Could you post your VB code of your DataSetData object?

Let's do this. Could you move your question to the original "Dispaly DataSet in DataGrid" thread since I don't think this is a WCF connection issue. I'll answer it there. This thread is getting too long.

 

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

peterralphylee
peterral...

Member

Member

21 points

11 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Yes the service seems to be working and has been in the past until I started trying to pass the datasetdata over, I'll move the question and post the code in the other thread for you. Thank you.

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

I'm still struggling with this issue...

I tried putting base.EndInvoke("MethodName", _args, result) in my quicklaunch window (the line where this error occurs). When I inspect the base object in the quicklaunch window, it shows me: {System.InvalidOperationException: End has already been called on this asynchronous result object. at System.ServiceModel.ASyncResult.End[TAsyncResult](IAsyncResult result)

Does this give anyone any clues about what's going wrong here? I can't google much on this error.

sladapter
sladapter

All-Star

All-Star

17427 points

3,171 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

I asked you to post your Service method and your return Object defination ( you said it was a complex type) that you are having problem with. But you never did.

Nobody knows what is going on in your code. I think your problem is definitely not connection (cross-domain issue) issue. It's a data serialization issue.


 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

klukkluk
klukkluk

Member

Member

0 points

8 Posts

Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Okay, it's a bit hard to explain, but i'll give it a try.

I'm trying to create a master detail scenario in silverlight. The master part, the screen with a datagrid, works fine, it's the detail part that doesn't work. Both master and detail screens use the same webservice, MasterDetail.svc. This returns a Response object. This Response object has column definitions and rows. Each row is a collection of cells, which are objects. I have defined the cells as objects because I want to create a generic solution for displaying data from any databasetable in my database. So when the databasecolumn can be mapped to an int, this results in the webservice to generate an <anytype xsi:type="xsd:int"> for this cell. Same for strings etc. Works perfectly for the master scenario.

In the detail scenario, the same Response object is returned, now with all columns from the current table. The cells collection is filled much like in the master scenario. But in this case it's also possible that the current databasecolumn is a relationship to another table. In the detailscreen, this should become a combobox. To fill this combobox, I need the data in the referenced table in the response object. So what I do is create another Response object, with column definitions and rows, and put this object in the cells collection. This gets serialized as: <anytype xsi:type="Response">. So, a Response object inside a Response object.

 I have put a bit of logging inside the webservice, an xmlserializer which writes to a new file on each request. The response gets written to file perfectly each time in both scenarios. But the detail scenario still raises the above exception in the reference.cs unfortunately. I also use Nukhil's web development helper to see what's going on. This logs the master response perfectly, but when the exception in detail mode is raised, this tool also raises an exception, so not much help there.

I appreciate your effort to look into this very much. If you need some logging files or some further explanation just let me know.

Tuizi
Tuizi

Member

Member

177 points

90 Posts

Re: Re: Re: Re: Re: Re: Re: Re: Calling webservice - Protocolexception - 404

Hello, Did you find a solution for this problem? Because, me, I just created a Service with a method named "DoWork" who return an int, and when I try to use this fonction from my silverlight application I get "ProtocolException: The remote server returned an unexpected response: (404) Not Found."

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities