473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Updating import schemaLocation in dynamic WSDL

Hi,

I'm re-writing my WSDLs to remove the port number using a
SoapExtensionReflector derived class. The ports are redirected at our
firewall so they're not required in the WSDL. Here's my code:

public override void ReflectDescription()
{
ServiceDescription serviceDescription =
ReflectionContext.ServiceDescription;

foreach (XmlSchema schema in serviceDescription.Types.Schemas)
{
foreach (XmlSchemaObject xmlSchemaObject in schema.Includes)
{
if (xmlSchemaObject is XmlSchemaImport)
{
XmlSchemaImport xmlSchemaImport =
(XmlSchemaImport)xmlSchemaObject;
xmlSchemaImport.SchemaLocation =
StripUriPort(xmlSchemaImport.SchemaLocation);
}
}
}

foreach (Service service in serviceDescription.Services)
{
foreach (Port port in service.Ports)
{
foreach (ServiceDescriptionFormatExtension extension in
port.Extensions)
{
if (extension is SoapAddressBinding)
{
SoapAddressBinding soapAddressBinding =
(SoapAddressBinding)extension;
soapAddressBinding.Location =
StripUriPort(soapAddressBinding.Location);
}
}
}
}
}

private string StripUriPort(string uriString)
{
string newUri = uriString;
if (uriString != null)
{
try
{
Uri uri = new Uri(uriString);
UriBuilder uriBuilder = new UriBuilder(uri.Scheme,
uri.Host, -1, uri.PathAndQuery);
newUri = uriBuilder.Uri.ToString();
}
catch
{
//do nothing
}
}
return newUri;
}

This works great for the soap address location but I also have a number of
schema import entries (for the dataset schema) and I can't modify the
schemaLocation to remove the port. What am I doing wrong?

Thanks,

Robin
Mar 30 '07 #1
0 2457

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: KC | last post by:
Is there anyway to cleanly model or even add the schema location - i.e. xsi:schemaLocation="http://myns.com http://myns.com/myshema location" - to a class that has been generated via wsdl.exe? I...
1
by: Stephen Edgecombe | last post by:
Hi Environment: Visual Studio .NET 2003 (vb) I am developing an XSD Schema and want to include some building blocks from another source, so they have a different namespace. - If I use an...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
2
by: LesleyW | last post by:
I'm using a public set of schemas for GML, avaiable at www.opengis.net/gml. They all include or import each other but live in a folder hierarchy, so the import statement includes...
1
by: MarkAurit | last post by:
I have been creating a webservice using the funtionality in vs.net to do so (in other words, I havent programmically created any xml). I have a need to modify the WSDL: specifically, I want to add...
2
by: Carmit | last post by:
Hi, I'm trying to build a proxy for this webservice: http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/EndTransactionLLSRQ.wsdl I'm getting the following error: Error: Unable to import...
3
by: Neter Smith | last post by:
I have run into a problem when trying to import a WSDL reference under VS 2003 and 1.1 of the framework. It appears as if it is in the generation of the proxy that things are failing. When I...
0
by: Dave Dunkin | last post by:
I ran into a problem last week where I was trying to create a .NET client for a doc/literal JBoss 4 web service. My WSDL included and imported serveral schemas (OAGIS schemas) from other files. It...
0
by: Steven Bolard | last post by:
Hello, I am trying to port my .net 1.1 application to 2.0. I am using vs2005. I am trying to get my webservices to run and although i can compile them and and get wsdl and service descriptions...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.