Error Adding Service Reference to WinForm project - c#

I want to consume a live service in my project but when I tried to add its reference, following error came:
The document at the url https://exdev.www.property24.com/Services/P24ListingService19.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.
- Report from 'DISCO Document' is 'Discovery document at the URL https://exdev.www.property24.com/Services/P24ListingService19.asmx could not be found.'.
- The document format is not recognized (the content type is 'application/xhtml+xml; charset=utf-8').
- Report from 'WSDL Document' is 'There is an error in XML document (3, 2).'.
- was not expected.
Metadata contains a reference that cannot be resolved: 'https://exdev.www.property24.com/Services/P24ListingService19.asmx'.
Metadata contains a reference that cannot be resolved: 'https://exdev.www.property24.com/Services/P24ListingService19.asmx'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
The Service URL can be browsed that is: https://exdev.www.property24.com/Services/P24ListingService19.asmx

I tried to add that web service reference under "Service References" but that was giving the above error.
The problem was that the Web Service was old so i managed to get its working reference by going to the "Advance" of Service Reference and adding it as "Web Reference".
As Web Reference can cope with old services.
It worked for me, hope it also will work for you!

Related

WCF Web Service / Visual Studio Community 2022 / Compiler Error CS0120

I want to access a web page in a Windows Forms app via SOAP.
Unfortunately, the compiler spits out many errors after I added the WCF Web Service to the project. What am I doing wrong here? The possible options don't tell me anything. The examples I found on the Internet could not help me with the errors.
Visual Studio Community 2022
WCF Web Service
URI: https://www.onlinembe.de/wsdl/OnlineMbeSOAP.wsdl
[ ] Always generate message contracts
[X] Reuse types in referece assemblies
[X] Reuse types in all referenced assemblies
Access level for generated classes:
[X] Public
Compiler Error CS0120
An object reference is required for the non-static field, method or property "ShipmentRequestType.System".
In 'Reference.cs' add 'using System.Xml.Schema;'
and replace
'Form=System.Xml.Schema.XmlSchemaForm.Unqualified'
with
Form='XmlSchemaForm.Unqualified'.

OpenSilver with Service References

Im trying to migrate a Silverlight application to OpenSilver.
The application uses WCF service references that are included in the project.
I followed the OpenSilver example on migrating from Silverlight to OpenSilver
https://doc.opensilver.net/documentation/migrate-from-silverlight/example.html
After wrapping the application with the OpenSilver files I get an error that my services namespace could not be found, then when trying to add that missing service reference to the project I get "The target framework 'netcoreapp2.0' is out of support"
Is there a step I am missing in setting this up?
If you get the error because you copy-pasted the server references as well
If you double click that error it should bring you to the Reference.svcmap file of your WCF service reference. Find the Reference.cs file in Solution Explorer next to Reference.svcmap.
Open it and you will see the same error multiple times in the code:
"The type name 'IHttpCookieContainerManager' could not be found in the namespace 'System.ServiceModel.Channels'. This type has been forwarded to assembly 'System.ServiceModel.Http, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly."
Solution: add the following nuget package: System.ServiceModel.Http
If you try to add a new service reference then follow this workaround: https://github.com/dotnet/wcf/issues/4766#issuecomment-1007859628
I hope that helps.

Add service reference fail

I have WCF Service, that has callback.
When I have 25 methods in callback all fine, but if I add 26-th method, Visual Studio(2013) can't update or add service reference. WTF?
Error message:
The URI prefix is not recognized.
Metadata contains a reference that cannot be resolved: 'net.tcp://127.0.0.1:9001/XXX.WCF/WCFService/mex'.
Metadata contains a reference that cannot be resolved: 'net.tcp://127.0.0.1:9001/XXX.WCF/WCFService/mex'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

error on adding webservice

i just created a webservice with visual studio 2010 and .net 4, and published it to my website subdomain. [subdomain has virtual directory and i have set the rules].
when i try to add my webservice to other c# project from "add service refference" => "advanced" => "add web refference" it just show me this error in "webservice found section"
The document at the url http://service.proapp.ir/sedardIP.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.
i added .svc application/octet to mime but nothing has changed i added
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>
too but nothing has changed , can u plz help me?????????????
tried adding refference without advanced throwing this error :
The document at the url service.proapp.ir/sedardIP.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.
- Report from 'DISCO Document' is 'There was an error downloading 'service.proapp.ir/service/sedardIP.asmx?disco'.'.
- The request failed with HTTP status 404: Not Found.
- Report from 'http://service.proapp.ir/sedardIP.asmx' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=utf-8').'.
Metadata contains a reference that cannot be resolved: 'service.proapp.ir/sedardIP.asmx'.
Metadata contains a reference that cannot be resolved: 'service.proapp.ir/sedardIP.asmx'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
In my experience, adding your web service reference straight - instead of going in the advanced section - from the service reference panel has never caused me any problem.
Perhaps try that.
Failing that, this will work:
try the same process service reference > add service reference with the following url
http://service.proapp.ir/sedardIP.asmx?WSDL

Consuming OTRS TicketConnector from .NET apps

I want to consume OTRS TicketConnector webservice in a .NET app.
Normally, the easiest way to get connected to a webservice is to import its WSDL via 'Add Service Reference'. Unfortunately, OTRS TicketConnector doesn't publish the WSDL.
I've found a custom WSDL for TicketConnector here. But when I'm trying to use it in 'Add Service Reference' it leads to an empty Reference.cs showing the following errors:
Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: There was a problem loading the XSD documents provided: a reference to a schema type with name 'OTRS_TicketCreate' and namespace 'http://www.otrs.org/TicketConnector/' could not be resolved because the type definition could not be found in the schema for targetNamespace 'http://www.otrs.org/TicketConnector/'. Please check the XSD documents provided and try again.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://www.otrs.org/TicketConnector/']/wsdl:portType[#name='GenericTicketConnector_Interface']
Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='http://www.otrs.org/TicketConnector/']/wsdl:portType[#name='GenericTicketConnector_Interface']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://www.otrs.org/TicketConnector/']/wsdl:binding[#name='GenericTicketConnector_Service']
Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://www.otrs.org/TicketConnector/']/wsdl:binding[#name='GenericTicketConnector_Service']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://www.otrs.org/TicketConnector/']/wsdl:service[#name='GenericTicketConnector']/wsdl:port[#name='GenericTicketConnector_endPoint']
Custom tool error: Failed to generate code for the service reference 'ServiceReference1'. Please check other error and warning messages for details.
I've tried to import the WSDL above via svcutil with no success.
Also, I've tried to import this WSDL via 'Add Web Reference' with the same results.
So my question is: how do you consume OTRS TicketConnector service from a .NET app?
Maybe you can give a code snippet or a proper WSDL that can be successfully imported with the .NET tools?
Also, I would appreciate any help in resolving issues with the WSDL errors I mentioned above.
Thanks to the OTRS community forum, I've got the answer. WSDLs for Ticket Connector are available at GitHub.

Categories