Geting meta data from Web Service

D

Dylan

Hello,


I was trying to do a WCF tutorial (http://wcf.netfx3.com/content/
BuildingHelloWorld.aspx). I need to get the meta data from my service
usin svcutil.exe why is not working? Please see below:


E:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>svcutil http://localhost/hello?wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version
3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.

Attempting to download metadata from 'http://localhost/hello?wsdl'
using WS-Metadata Exchange or
DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version
3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.

Error: Cannot obtain Metadata from http://localhost/hello?wsdl

If this is a Windows (R) Communication Foundation service to which you
have access, please check
that you have enabled metadata publishing at the specified address.
For help enabling metadata
publishing, please refer to the MSDN documentation at
http://go.microsoft.com/fwlink/?LinkId=65
455.


WS-Metadata Exchange Error
URI: http://localhost/hello?wsdl

Metadata contains a reference that cannot be resolved: 'http://
localhost/hello?wsdl'.

Content Type application/soap+xml; charset=utf-8 was not supported
by service http://localho
st/hello?wsdl. The client and service bindings may be mismatched.

The remote server returned an error: (415) Cannot process the
message because the content ty
pe 'application/soap+xml; charset=utf-8' was not the expected type
'text/xml; charset=utf-8'..


HTTP GET Error
URI: http://localhost/hello?wsdl

The HTML document does not contain Web service discovery
information.

If you would like more help, type "svcutil /?"

E:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>
 
M

Marc Gravell

If you use a "hello world" svc file hosted in IIS (which you can get
by installing the WCF/WPF CTP onto VS2005), then simply browsing to
the svs tells you exactly how to enable mex. To quote (and note the
link at the bottom):

================

Service


This is a Windows© Communication Foundation service.

Metadata publishing for this service is currently disabled.

If you have access to the service, you can enable metadata publishing
by completing the following steps to modify your web or application
configuration file:

1. Create the following service behavior configuration, or add the
<serviceMetadata> element to an existing service behavior
configuration:

<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>

2. Add the behavior configuration to the service:

<service name="MyNamespace.MyServiceType"
behaviorConfiguration="MyServiceTypeBehaviors" >

Note: the service name must match the configuration name for the
service implementation.

3. Add the following endpoint to your service configuration:

<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="mex" />

Note: your service must have an http base address to add this
endpoint.

The following is an example service configuration file with metadata
publishing enabled:

<configuration>
<system.serviceModel>

<services>
<!-- Note: the service name must match the configuration
name for the service implementation. -->
<service name="MyNamespace.MyServiceType"
behaviorConfiguration="MyServiceTypeBehaviors" >
<!-- Add the following endpoint. -->
<!-- Note: your service must have an http base address
to add this endpoint. -->
<endpoint contract="IMetadataExchange"
binding="mexHttpBinding" address="mex" />
</service>
</services>

<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<!-- Add the following element to your service
behavior configuration. -->
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>

</system.serviceModel>
</configuration>

For more information on publishing metadata please see the following
documentation: http://go.microsoft.com/fwlink/?LinkId=65455.
 
D

Dylan

Dylan,

If you go tohttp://localhost/hello?wsdlin your browser, do you get
anything?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




I was trying to do a WCF tutorial (http://wcf.netfx3.com/content/
BuildingHelloWorld.aspx). I need to get the meta data from my service
usin svcutil.exe why is not working? Please see below:
E:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>svcutil
http://localhost/hello?wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version
3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://localhost/hello?wsdl'
using WS-Metadata Exchange or
DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version
3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot obtain Metadata fromhttp://localhost/hello?wsdl
If this is a Windows (R) Communication Foundation service to which you
have access, please check
that you have enabled metadata publishing at the specified address.
For help enabling metadata
publishing, please refer to the MSDN documentation at
http://go.microsoft.com/fwlink/?LinkId=65
455.
WS-Metadata Exchange Error
URI:http://localhost/hello?wsdl
Metadata contains a reference that cannot be resolved: 'http://
localhost/hello?wsdl'.
Content Type application/soap+xml; charset=utf-8 was not supported
by servicehttp://localho
st/hello?wsdl. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the
message because the content ty
pe 'application/soap+xml; charset=utf-8' was not the expected type
'text/xml; charset=utf-8'..
The HTML document does not contain Web service discovery
information.
If you would like more help, type "svcutil /?"
E:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>- Hide quoted text -

- Show quoted text -

Hi,

When I put http://localhost/hello?wsdlin in the browser,

I get the Service page and this message at the top: "Metadata
publishing for this service is currently disabled"
I guess I have not hosted my the service properly and have not enabled
metadata publishing.



Dylan
 
M

Marc Gravell

I guess I have not hosted my the service properly and have not enabled
metadata publishing.

The two aren't related. The fact you see something other thant a
yellow-screen-of-death tells me it is hosted fine. Metadata publishing
isn't enabled by default, but just follow the steps it cites.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top