Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recording.wsdl seems to be malformatted #214

Closed
bvkdevelopment opened this issue Apr 27, 2022 · 13 comments
Closed

recording.wsdl seems to be malformatted #214

bvkdevelopment opened this issue Apr 27, 2022 · 13 comments

Comments

@bvkdevelopment
Copy link

During generating codes ( c# and java ) from recording.wsdl, i get errors. And both convertion tools ( svcutil and wsimport ) return with parsing erros. It seems wsdl file is not well formatted. Here are the outputs of both command line tools.

wsimport recording.wsdl
parsing WSDL...


[ERROR] Could not find wsdl:service in the provided WSDL(s): 

file:/D:/bvkrepo/devproj/specs/wsdl/ver10/recording.wsdl
 At least one WSDL with at least one service definition needs to be provided.


	Failed to parse the WSDL.
svcutil recording.wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.8.3928.0]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:StringList' is not declared, or is not a simple type.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:StringAttrList' is not declared, or is not a simple type.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:ArrayOfFileProgress' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:ReferenceToken' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:SearchScope' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:StorageReferencePath' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:RecordingReference' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:RecordingJobStateInformation' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:RecordingJobReference' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:RecordingJobMode' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:RecordingJobConfiguration' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:GetRecordingJobsResponseItem' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:TrackReference' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:TrackConfiguration' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:RecordingConfiguration' is not declared.


Error: There was an error verifying some XML Schemas generated during export:
Type 'http://www.onvif.org/ver10/schema:GetRecordingsResponseItem' is not declared.


Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://www.onvif.org/ver10/schema:StringList' is missing.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.onvif.org/ver10/recording/wsdl']/wsdl:portType[@name='RecordingPort']


Error: 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.onvif.org/ver10/recording/wsdl']/wsdl:portType[@name='RecordingPort']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.onvif.org/ver10/recording/wsdl']/wsdl:binding[@name='RecordingBinding']


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.

@HansBusch
Copy link
Member

HansBusch commented Apr 28, 2022

If you copy the wsdl file to your PC you also have to copy the related schema files to the relative appropriate folder or change the import statements. Note that you can directly copy the URL of the wsdl file to the Microsoft tools. For recording.wsdl it is

https://www.onvif.org/ver10/recording.wsdl

@bvkdevelopment
Copy link
Author

Command is run after cloning repo not on only file. And it is running properly on other wsdl files.

@HansBusch
Copy link
Member

Just verified that it works with following url
file:///D:\onvif\specs\22.06\wsdl\ver10/recording.wsdl

@bvkdevelopment
Copy link
Author

it didnt work as well. Procedure which i apply is as follow;
-> Clone the project to any folder
-> Run the commands

I expect that it shoukd work on pure repo

@HansBusch
Copy link
Member

The log above shows as URL: file:/D:/bvkrepo/devproj/specs/wsdl/ver10/recording.wsdl

From my understanding file must be trailed with three slashes.

@bvkdevelopment
Copy link
Author

I dont get your point.
wsimport and svcutil standart tools come from java and .net frameworks. Log shows these tools properly reach file and determines it is malformmated. Why dont you focus why these tools are not able to generate code from your wsdl file. Just give a chance and try. Tools are command and anyone can reach for free.

@HansBusch
Copy link
Member

After having verified that both Oxygen XML verification passes and Visual Studio Service References imports the file online and from disk, ONVIF conclusion is that the file definition is correct.

Nevertheless we are interested to know in case you should happen to find out the root cause so that this information can be shared in the community.

@bvkdevelopment
Copy link
Author

Interesting because errors are so obvious. I shared again error lines which comes from svcutil. Btw, it is same error which is in my previous issue and it was fixed with latest commit. Take a look at #193

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://www.onvif.org/ver10/schema:StringList' is missing.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.onvif.org/ver10/recording/wsdl']/wsdl:portType[@name='RecordingPort']

Error: 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.onvif.org/ver10/recording/wsdl']/wsdl:portType[@name='RecordingPort']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.onvif.org/ver10/recording/wsdl']/wsdl:binding[@name='RecordingBinding']

@HansBusch
Copy link
Member

Events (and #193) are a special case, because ONVIF is relying on OASIS base notification schema. which have same name for port type and complex type. Unfortunately Microsoft tools cannot cope with that name collision while others work fine. For that reason ONVIF provides a special version including a modified OASIS component that compiles with Visual Studio.

I've double checked the tt:StringList definition. It is defined in onvif.xsd and the Oxygen editor finds it as long as the import points to the correct file.

@bvkdevelopment
Copy link
Author

what visualstudio version do you use? I tried with 2022 and got errors. Look at the following screen shot

image

@HansBusch
Copy link
Member

You can safely ignore these validation errors. ONVIF is using XML schema 1.1 while the Microsoft parser sticks to 1.0 and the compiler complains about xs:any after optional elements. The generator still generates code.

@bvkdevelopment
Copy link
Author

I dont think these are ignorable prompt. Anyway i got error and visual studio 2022 did not generate code

image

@HansBusch
Copy link
Member

Verified with VS 2022 that also this version works as expected. Shows validation errors as in screenshots above due to XML 1.0 validation. However validation errors have no impact on project compilation and linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants