wcf - Xamarin Android - Making a Rest request with a complex parameter (object) throws exception, in .NET it works fine (Using channel factory) -


i'm starting use mono droid or xamarin android, so, idea reuse of code use in .net.

one of things need android , ios application make calls web services made available using wcf rest json encoding.

so code simple:

webhttpbinding webbinding = new webhttpbinding(); endpointaddress endpointaddress = new endpointaddress("http://192.168.126.24:8025/services/securitymanagement"); channelfactory<isecuritymanagement> newfactory = new channelfactory<isecuritymanagement>(webbinding, endpointaddress);  newfactory.endpoint.behaviors.add(new webhttpbehavior() { defaultoutgoingrequestformat = system.servicemodel.web.webmessageformat.json, defaultoutgoingresponseformat = system.servicemodel.web.webmessageformat.json });  newfactory.endpoint.behaviors.add(new restendpointbehavior());  isecuritymanagement newproxy = newfactory.createchannel(); validateuserexistenceoutput output = newproxy.validateuserexistence(new validateuserexistenceinput() { domain = "critical", username = "myusername" }); 

simple enough me started (at least, idea mono, make in .net reuse in mono)

but when run code following exception exception:

system.notsupportedexception: loading... 07-25 10:43:40.922 e/mono    ( 1950):  07-25 10:43:40.922 e/mono    ( 1950): unhandled exception: 07-25 10:43:40.922 e/mono    ( 1950): system.notsupportedexception: conversion argument parametertype 'businessorchestration.securitymanagement.inputobjects.validateuserexistenceinput' not supported 07-25 10:43:40.922 e/mono    ( 1950):   @ system.servicemodel.dispatcher.querystringconverter.convertvaluetostring (system.object parameter, system.type parametertype) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono-rt ( 1950):   @ system.servicemodel.dispatcher.webmessageformatter+webclientmessageformatter.serializerequest (system.servicemodel.channels.messageversion messageversion, system.object[] parameters) [0x00000] in <filename unkno07-25 10:43:40.922 e/mono    ( 1950):   @ system.servicemodel.dispatcher.webmessageformatter+webclientmessageformatter.serializerequest (system.servicemodel.channels.messageversion messageversion, system.object[] parameters) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono    ( 1950):   @ system.servicemodel.description.webhttpbehavior+clientpairformatter.serializerequest (system.servicemodel.channels.messageversion messageversion, system.object[] parameters) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono    ( 1950):   @ system.servicemodel.monointernal.clientruntimechannel.createrequest (system.servicemodel.dispatcher.clientoperation op, system.object[] parameters) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono    ( 1950):   @ system.servicemodel.monoin 07-25 10:43:40.922 e/mono-rt ( 1950): [error] fatal unhandled exception: system.notsupportedexception: conversion argument parametertype 'businessorchestration.securitymanagement.inputobjects.validateuserexistenceinput' not supported 07-25 10:43:40.922 e/mono-rt ( 1950):   @ system.servicemodel.dispatcher.querystringconverter.convertvaluetostring (system.object parameter, system.type parametertype) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono-rt ( 1950):   @ system.servicemodel.dispatcher.webmessageformatter+webclientmessageformatter.serializerequest (system.servicemodel.channels.messageversion messageversion, system.object[] parameters) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono-rt ( 1950):   @ system.servicemodel.description.webhttpbehavior+clientpairformatter.serializerequest (system.servicemodel.channels.messageversion messageversion, system.object[] parameters) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono-rt ( 1950):   @ system.servicemodel.monointernal.clientruntimechannel.createrequest (system.servicemodel.dispatcher.clientoperation op, system.object[] parameters) [0x00000] in <filename unknown>:0  07-25 10:43:40.922 e/mono-rt ( 1950):   @ system.servic program 'mono' has exited code 0 (0x0). 

i'm using exact same code in .net 4.5 application , works fine, seems failing when converting object string (a json string, suppose).

should work directly in mono since works in .net?

do guys have services complex input objects? api use make these calls?

thanks ahead help,

luis pinho

it doesn't work because of object used in code hasn't been ported mono since microsoft specific. there information here : mono class status

for example, namespace microsoft.enterprisemanagement used isecuritymanagement in code never ported.

to work on both mono or .net code must follow .net standard. it's work in progress harmonize mono, .net , .net core framework compile common libraries , programs less code differences.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -