Consuming OTRS TicketConnector from .NET apps - c#

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.

Related

An exception was thrown while running a WSDL import extension

I got this error while adding WSDL into my ASP.NET Core Web API project using .NET 7.0. However, it works fine using SOAP UI when company's VPN is connected.
Cannot import wsdl:port\r\nDetail: \r\nXPath to Error Source: //wsdl:definitions[#targetNamespace='urn:telmaServices']/wsdl:service[#name='telmaServices']/wsdl:port[#name='mbJIRServicePort']
Cannot import wsdl:binding\r\nDetail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.\r\nXPath to wsdl:portType: //wsdl:definitions[#targetNamespace='urn:telmaServices']/wsdl:portType[#name='mbJIRServicePortType']\r\nXPath to Error Source: //wsdl:definitions[#targetNamespace='urn:telmaServices']/wsdl:binding[#name='mbJIRServiceBinding']
Cannot import wsdl:portType\r\nDetail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter\r\nError: These members may not be derived.\r\nXPath to Error Source: //wsdl:definitions[#targetNamespace='urn:telmaServices']/wsdl:portType[#name='mbJIRServicePortType']

How to use proxy authentication with xsd.exe

I'm trying to use xsd.exe to create a c# class. In particular I'm trying to use http://schemas.opengis.net/wms/1.1.1/capabilities_1_1_1.xml to generate the xsd to then generate the class. I managed to get a class from the 1.3.0 version of the specification via xsd.exe in windows command line but when I try to do the same for this version I get a proxy authentication error like below.
Does anyone know why I would be getting this error when I didn't for the other translation? Also if it really is my proxy blocking xsd then how do I tell xsd to use my credentials for http requests?
![Proxy error image][2]
Let me know if you need more information. Thanks for your time in advance
[2]: http://i.stack.imgur.com/CIbHM.jpg
EDIT: The image doesn't seem to be working for me so I'll just write the error message -
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin>xsd.exe capabilities_1_1_1.xml
Microsoft (R) XML Schemas/Datatypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All Rights Reserved.
Error: There was an error processing 'capabilities_1_1_1.xml".
- The remote server returned an error: (407) Proxy Authentication Required.
If you would like more help, please type "xsd /?".
For this one I figured out that the WMS.xml provided by the OGC does NOT have all it's namespaces working correctly. In particular one of the URL references (http://www.digitalearth.gov/wmt/xml/capabilities_1_1_1.dtd) does NOT exist anymore which was confusing my network hence returning a 407 proxy authentication required error.
THE SOLUTION:
Change the DTD referenced in OGCs capabilities.xml file to point to the DTD on their website. Why it doesn't already point to that by default I DO NOT KNOW. digitalearth.gov looks like it's been down since 2006 so it's very old. Anyway once the reference for the DTD was changed I was able to create the XSD and c# class with ease.

How can I correct the WSDL when the policy expression's "normalized form was too large"

So - I've been tasked with creating a proxy client to the following service, but I'm having a heck of a time generating a client that's happy with the requirements. The WSDL is located here: https://ws.conf.ebs.health.gov.on.ca:1441/EDTService/EDTService?wsdl
When I run svcutil, I get the following output:
C:\Temp>"C:\Program Files (x86)\Microsof
t SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\svcutil.exe" /t:code https://ws.conf.
ebs.health.gov.on.ca:1441/EDTService/EDTService?wsdl /out:ebs.cs /config:ebs.con
fig
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.32559]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'https://ws.conf.ebs.health.gov.on.ca:1441/
EDTService/EDTService?wsdl' using WS-Metadata Exchange or DISCO.
Warning: The policy expression was not fully imported because its normalized for
m was too large.
XPath:"XPath Unavailable"
Error: Cannot import wsdl:binding
Detail: Object reference not set to an instance of an object.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:binding[#name='EDTPortBinding']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:binding[#name='EDTPortBinding']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:service[#name='EDTService']/wsdl:port[#name='EDTPort']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:binding[#name='EDTPortBinding']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:service[#name='EDTService']/wsdl:port[#name='EDTPort.2']
I've tried the same command using versions: 3.0.4506.2152, 4.0.30319.18020 and 4.0.30319.32559 with the same outcome. Any ideas?
I have created a proxy using WSDL.exe (inheriting from Microsoft.Web.Services3.WebServicesClientProtocol) at some point but I've had to config everything myself and I'm running into exceptions every time I receive a response (catch the exception, decrypt the response body manually and repeat). Also, I have to use MTOM which makes this custom code work even less.

Error Adding Service Reference to WinForm project

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!

svcutil.exe - Error: Cannot import wsdl:portType

I have to integrate several existing webservices in my .net application. But unfortunately, invoking the svcutil tool results in an error with the message:
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot import wsdl:binding
Detail: Cannot find definition for http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/V1.0:EnviarRespuestaVerifi
carIdentidadCliente. Service Description with namespace http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/V1.0
is missing.
Parameter name: name
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/E
nlace/V1.0']/wsdl:binding[#name='EnviarRespuestaVerificarIdentidadCliente_HttpBinding']
Error: 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://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/E
nlace/V1.0']/wsdl:binding[#name='EnviarRespuestaVerificarIdentidadCliente_HttpBinding']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/E
nlace/V1.0']/wsdl:service[#name='EnviarRespuestaVerificarIdentidadCliente']/wsdl:port[#name='EnviarRespuestaVerificarIdentidadCliente_HttpPort']
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.
Has anyone an idea what causes this problem?
I'm seeing the same issue. I have a set of 30-odd wsdl files in a folder and am trying to create C# client classes for them all.
If I do the following
svcutil /noconfig /namespace:*,My.Required.Namespace *.wsdl
I see a lot of the error you mention (Cannot import wsdl:binding).
However, picking one file at a time
svcutil /noconfig /namespace:*,My.Required.Namespace a.wsdl
Frequently works; sometimes I have to include another file, e.g.
svcutil /noconfig /namespace:*,My.Required.Namespace b.wsdl c.wsdl
This is necessary when attempting to run svcutil on b.wsdl fails due to a dependency on c.wsdl.
Bottom line: I am not sure why I can't create contracts for all of these service definitions in one go, but it doesn't seem possible. I still have a big problem with shared types across the files; this means I effectively have to edit either third-party wsdl or the automatically generated code in order to get things to compile and run correctly.

Categories