diff --git a/Mozi.HttpEmbedded/Attributes/ResponseContentTypeAttribute.cs b/Mozi.HttpEmbedded/Attributes/ResponseContentTypeAttribute.cs new file mode 100644 index 0000000000000000000000000000000000000000..31c676c34232a8df8c1ce755d014c2507865fd22 --- /dev/null +++ b/Mozi.HttpEmbedded/Attributes/ResponseContentTypeAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Mozi.HttpEmbedded.Attributes +{ + /// + /// 响应内容 文档类型 + /// + [AttributeUsage(AttributeTargets.ReturnValue)] + internal class ResponseContentTypeAttribute : Attribute + { + public string ContentType { get; set; } + public string Encoding { get; set; } + public ResponseContentTypeAttribute(string contentType,string encoding) + { + ContentType = contentType; + Encoding = encoding; + } + public ResponseContentTypeAttribute(string contentType):this(contentType,"") + { + + } + } +} diff --git a/Mozi.HttpEmbedded/Attributes/WebServiceAttribute.cs b/Mozi.HttpEmbedded/Attributes/WebServiceAttribute.cs new file mode 100644 index 0000000000000000000000000000000000000000..bc3d4f38e8abb2f14eacc2e4f69c91888d7c3de8 --- /dev/null +++ b/Mozi.HttpEmbedded/Attributes/WebServiceAttribute.cs @@ -0,0 +1,11 @@ +using System; + +namespace Mozi.HttpEmbedded.Attributes +{ + [AttributeUsage(AttributeTargets.Class)] + internal class WebServiceAttribute:Attribute + { + public string Namespace = ""; + public string DocumentName = ""; + } +} diff --git a/Mozi.HttpEmbedded/Mozi.HttpEmbedded.csproj b/Mozi.HttpEmbedded/Mozi.HttpEmbedded.csproj index dca672ed516ffcf3621e469145d22e98e1ee8ba9..a83cde492f093df97ca08e740cc8adde2a6d764e 100644 --- a/Mozi.HttpEmbedded/Mozi.HttpEmbedded.csproj +++ b/Mozi.HttpEmbedded/Mozi.HttpEmbedded.csproj @@ -65,6 +65,8 @@ + + diff --git a/Mozi.HttpEmbedded/Page/RuntimeApi.cs b/Mozi.HttpEmbedded/Page/RuntimeApi.cs index c22dc4a250390552023935c4392f65e00bb38990..cc65c7c9ef31e655505cc027933491f9e00afca9 100644 --- a/Mozi.HttpEmbedded/Page/RuntimeApi.cs +++ b/Mozi.HttpEmbedded/Page/RuntimeApi.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Reflection; +using Mozi.HttpEmbedded.Attributes; namespace Mozi.HttpEmbedded.Page { diff --git a/Mozi.HttpEmbedded/WebService/SOAP.cs b/Mozi.HttpEmbedded/WebService/SOAP.cs index 64f2f93b7ff0527fa95843296fc575a510381ac8..9c984a8da8a22cc15d3eae5ca8fdc5dda05d1190 100644 --- a/Mozi.HttpEmbedded/WebService/SOAP.cs +++ b/Mozi.HttpEmbedded/WebService/SOAP.cs @@ -5,11 +5,14 @@ using Mozi.HttpEmbedded.Generic; namespace Mozi.HttpEmbedded.WebService { + /// + /// SOAP envelope封装 + /// public class SOAPEnvelope { - public string xsi = "http://www.w3.org/2001/XMLSchema-instance"; - public string xsd= "http://www.w3.org/2001/XMLSchema"; - public string encodingStyle = "http://www.w3.org/2001/12/soap-encoding"; + public string NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"; + public string NS_XSD= "http://www.w3.org/2001/XMLSchema"; + public string EncodingStyle = "http://www.w3.org/2001/12/soap-encoding"; /// /// SOAP版本 @@ -34,9 +37,9 @@ namespace Mozi.HttpEmbedded.WebService XmlTextWriter writer = new XmlTextWriter(ms, System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.WriteStartElement(envelope.Version.Prefix, "Envelope", envelope.Version.Namespace); - writer.WriteAttributeString(envelope.Version.Prefix, "encodingStyle",null,envelope.encodingStyle); - writer.WriteAttributeString("xmlns", "xsi",null,envelope.xsi); - writer.WriteAttributeString("xmlns", "xsd", null,envelope.xsd); + writer.WriteAttributeString(envelope.Version.Prefix, "encodingStyle",null,envelope.EncodingStyle); + writer.WriteAttributeString("xmlns", "xsi",null,envelope.NS_XSI); + writer.WriteAttributeString("xmlns", "xsd", null,envelope.NS_XSD); //header if (envelope.Header != null) { @@ -56,6 +59,7 @@ namespace Mozi.HttpEmbedded.WebService { writer.WriteElementString(envelope.Body.Prefix, r.Key,null, r.Value); } + //fault writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); @@ -81,9 +85,9 @@ namespace Mozi.HttpEmbedded.WebService //envelope var nodeEnvelope = doc.CreateNode(XmlNodeType.Element, envelope.Version.Prefix,"Envelope", envelope.Version.Namespace); - var encodingStyle =doc.CreateAttribute("soap","encodingStyle",envelope.encodingStyle); + var encodingStyle =doc.CreateAttribute("soap","encodingStyle",envelope.EncodingStyle); var xsi = doc.CreateAttribute("xmlns", "xsi",null); - xsi.Value = envelope.xsi; + xsi.Value = envelope.NS_XSI; var xsd = doc.CreateAttribute("xsd","xsd", null); nodeEnvelope.Attributes.Append((XmlAttribute)xsi); @@ -134,6 +138,7 @@ namespace Mozi.HttpEmbedded.WebService } public class SOAPHeaderChild { + public string Name { get; set; } public string actor {get;set;} public string mustUnderstand { get; set; } //"0"|"1" public string encodingStyle { get; set; } @@ -150,7 +155,11 @@ namespace Mozi.HttpEmbedded.WebService public class SOAPFault { - public string faultcode { get; set; } + //VersionMismatch SOAP Envelope 元素的无效命名空间被发现 + //MustUnderstand Header 元素的一个直接子元素(带有设置为 "1" 的 mustUnderstand 属性)无法被理解。 + //Client 消息被不正确地构成,或包含了不正确的信息。 + //Server 服务器有问题,因此无法处理进行下去。 + public string faultcode { get; set; } public string faultstring { get; set; } public string faultactor { get; set; } public string detail { get; set; } diff --git a/Mozi.HttpEmbedded/WebService/WSDL.cs b/Mozi.HttpEmbedded/WebService/WSDL.cs index 739de1c779639cccd3bd2fdb17d310c070940a33..d3e9ef5bf2f44738f654b37a7de8c21fe8464bca 100644 --- a/Mozi.HttpEmbedded/WebService/WSDL.cs +++ b/Mozi.HttpEmbedded/WebService/WSDL.cs @@ -1,7 +1,77 @@ namespace Mozi.HttpEmbedded.WebService { - class WSDL + /// + /// WSDL描述文档 + /// + public class WSDL { + public string NS_tm = "http://microsoft.com/wsdl/mime/textMatching/"; + public string NS_soapenc = "http://schemas.xmlsoap.org/soap/encoding/"; + public string NS_mime = "http://schemas.xmlsoap.org/wsdl/mime/"; + public string NS_tns = "Service/ServiceCommon/User"; + public string NS_soap = "http://schemas.xmlsoap.org/wsdl/soap/"; + public string NS_s = "http://www.w3.org/2001/XMLSchema"; + public string NS_soap12 = "http://schemas.xmlsoap.org/wsdl/soap12/"; + public string NS_http = "http://schemas.xmlsoap.org/wsdl/http/"; + + public string Prefix = "wsdl"; + public string WSDLNamespace = "http://schemas.xmlsoap.org/wsdl/"; + public string Namespace = "http://tempurl.org"; + + public string Documentation { get; set; } + + + public static string CreateDocument(WSDL document) + { + var text = ""; + return text; + } + public class Document + { + public string Name { get; set; } + public string Namespace = "http://schemas.xmlsoap.org/wsdl/"; + } + private class Types + { + public string Schema { get; set; } + public string Prefix = "xs"; + private class Element + { + public string minOccurs = ""; + public string maxOccurs = ""; + public string name = ""; + public string type = ""; + } + } + + private class Message + { + public class Part + { + public string Name { get; set; } + public string Element { get; set; } + } + } + + private class PortType + { + + } + + private class ServiceType + { + + } + + private class Binding + { + + } + + private class Service + { + + } } }