Development and deployment points of OMS Development

Source: Internet
Author: User

 

OMS development overview

In the previous article, we introduced the features and basic development overview of OMS. This article details the specific problems and solutions encountered in practice. This article involves the development of common text messages, excluding MMs.

 

Key Points of OMS Development

In general, developing OMS is not very difficult. After all, there are only four interfaces, and the parameters are not very complex.We strongly recommend that youCodeTo debug. The actual operation problems are as follows:

Getserviceinfo return value description

For the meanings of some attributes in the returned values of getserviceinfo, see the official documentation:

<Supportedservice> <! -- Maxrecipientspermessage: Maximum number of recipients --> <! -- Maxmessagespersend: represents the number of separate SMS messages allowed in one xmsdata. --> <! -- Maxsbcspermessage: the number of characters in each text message, which is us ascii characters --> <! -- Maxdbcspermessage: double-byte text for each text message --> <sms_sender maxrecipientspermessage = "50" maxmessagespersend = "20" maxsbcspermessage = "128" maxdbcspermessage = "70"/> </supportedservice>

These values are set by the server. You can use a fixed XML file for the entire serviceinfo content.ProgramYou only need to simply read the data and return it to the client. The four attribute values mentioned above will affect the behavior of the Outlook client, such as paging display during text message preview.

Note: the value of the <serviceuri> field must be exactly the same as the URI entered by the user on the client, otherwise, outlook reports an error even if the URI returned by the server is inconsistent with the one entered by the user after calling getserviceinfo, and replaces the URI in the user input box.

 

Serialization and deserialization object processing incoming and outgoing

The four interfaces defined in the official document, whether the parameters or returned values, are all strings of C # (STD: wstring should be used for C ++ ). However, the parameters here are strings in XML format and must be parsed by the server. Using xsdfile. XSD/C), you can use xmlserailer for convenient serialization and deserialization. Refer to the following code for serialization and deserialization:

Private Static string xmlserializer <t> (T serialobject) where T: Class {xmlserializer SER = new xmlserializer (typeof (t); system. io. memorystream mem = new memorystream (); xmltextwriter writer = new xmltextwriter (MEm, encoding. unicode); Ser. serialize (writer, serialobject); writer. close (); Return encoding. unicode. getstring (mem. toarray ();} Private Static t xmldeserialize <t> (string Str) where T: Class {xmlserializer myserializer = new xmlserializer (typeof (t )); streamreader MEM2 = new streamreader (New memorystream (system. text. encoding. unicode. getbytes (STR), system. text. encoding. unicode); Return (t) myserializer. deserialize (MEM2 );}
  For the XML schema officially given

The format of the deliverxms parameter xmsdata is complex, and the format of the returned value string is also a bit difficult. However, when I construct an xmsresponse in the Code and serialize it into XML and return it to outlook, outlook did say that sending failed. After careful comparison, we found that the serialized XML document had two more namespaces, but we had to manually construct the XML document in the code to return the results.

Conclusion: for the input parameters xmsuser and xmsdata, the schema and the generated class can be used and deserialized into an object to read the information sent by outlook. For output parameters, we recommend that you manually construct XML.

 

Key Points of OMS deployment

 

It has been mentioned many times that OMS development is not difficult, but it is difficult to deploy, especially for those who have no web deployment experience before.

I read the error message countless times.

After WS is developed, you need to deploy and test it. Clicking test account settings is of course the first level. However, during the test, I can't remember how many times the following error has popped up. Every time I see this error, it is always quite lost, because this error cannot provide us with any useful information, we strongly recommend that you use outlook to write logs so that developers can check where the WS deployment is incorrect.

Error 1

HTTP or HTTPS

If you do not read the document carefully, you will not notice that the developed ws must use the HTTPS protocol. You need to provide SSL encrypted communication support. If the URL entered at the time of setting is prefixed with HTTP, outlook will not try to connect to the server and will give the following error message:

Error 2

Of course, as a software that exchanges sensitive information in the network environment, security issues must be taken into account, but we do not think it should be "killed ", if this WS is deployed in an enterprise's Intranet environment and you do not need to consider Transmission security, there is no need to use HTTPS because it will increase the difficulty of deployment and development. We think it may be a good idea to enable an option here.

For this reason, we need to bind https, certificate, and SSL when deploying ws.

 

Certificate? Certificate!

Before that, I had no idea about Ca and certificate. I only knew that the browser always prompts threats when accessing HTTPS. I understood some things when doing this application (for details about Ca and certificate, refer to HTTPS \ SSL \ digital certificate ). Outlook must provide a trusted certificate on the server,You can use iis7 management tools to generate a self-authenticated certificate.. This certificate is issued by the machine name. In the IE certificate authentication system, a certificate is tested in three aspects:

    • Whether the certificate is trusted
    • Certificate Expired?
    • Whether the certificate issuer has the same name as the accessed host

If one of the three conditions does not match, the threat prompt is displayed in IE8. When browsing the Web page, you can click "continue access", and the address bar is red at random. However, in outlook, all three conditions must be met to be trusted.

For the first condition, you only need to import the certificate to the Trusted Root Certification Authorities of the client IE browser. Of course, it includes certificates from some authoritative certification bodies. If you have the ability to apply for a certificate from these organizations, your certificate will become a sub-Certificate of their certificate, without importing the certificate to the client, you can also be trusted.

If the second condition expires, I want to get another one.

The third condition is that the self-authentication certificate generated by the iis7 management tool uses the machine name as the issuer. Therefore, in the settings of the Outlook client, the machine name must be used as the main domain name and the IP address cannot be used.

Deploy an HTTPS site in iis7 +

Deploying an OMS site is no different from deploying a common HTTPS site. We recommend that you use a browser before testing. When the browser can access the site with full trust, you can test the Outlook client. At the same time, you can easily track method calls by writing logs during method calls on the server. If getserviceinfo is not called, it must be an HTTPS site setting problem. The following is an example of Windows Server 2008 R2:

Window Server 2008 R2 uses roles to Manage Server service components. First, activate IIS: Add a role and select Web Server (IIS)

When selecting the IIS ancillary components, remember to check ASP. NET support. Then you can proceed all the way.

Publish your ASP. NET web service. If it is Based on. NET 4.0, install. Net 4.0 and run the aspnet_regiis-I command to set IIS.

    • Create a new site in IIS management tool

The physical path points to the path of the published site. Use http binding first. In order not to repeat the default site, use port 8082. After the creation is successful, as shown in:

It is difficult to set the permissions for anonymous users to access the site. To do this, double-click authentication in IIS, edit anonymous autherntication, and change it to application pool identity.

Then, go to application pools, select the application pool used by the site, click Advanced Settings on the right, modify the identity attribute, and select LocalSystem.

Now you can access the site's. asmx file using a browser on the server to see the web service method list page. Set a firewall to allow external users to access the site through a browser.

 

As mentioned aboveOMS must be bound to an HTTPS siteTherefore, our website must be bound to HTTPS. For more information about https, refer to HTTPS \ SSL \ digital certificate.

    • Create a Server Self-signed certificate

Click the local icon on the Right of IIS manager and double-click server certificatin on the right to go to the following page:

Click create self-signed certificate on the right.

Enter any characters, such as "OMS ". OK. This will generate a self-signed certificate, such.

Edit the binding of the site, select https mode, and retain the port 443. Select the generated certificate: OMS.

Double-click SSL settings on the right, select required SSL, ignore the client certificate, and apply.

In this way, the website is bound to https, And the HTTP method cannot be accessed. Use a browser to access. asmx over HTTPS. The following interface indicates that HTTPS is successfully set. You can see the web service method list after accessing

    • Export the server certificate and install it on the client

After installing the self-signed certificate for the server on the client, go to the site binding dialog box again and select the HTTPS Editor:

Click View to view the certificate and switch to details.

Click Copy to file to enter the certificate export wizard. on the following page, select do not export the private key.

Follow the Wizard to export the certificate, copy the certificate to the client, and install the certificate on the client in "Trusted Root Certificate Issuer.

Test the HTTPS site in the client browser. If the site can be accessed without interruption, it is half done.

Enter the HTTPS site address in the Outlook client configuration,Note that the IP address cannot be entered here. It must be the machine name and then click "test ".If the server-side code has no problems, it will be able to succeed immediately, but it is usually difficult, but if you write a log,If getserviceinfo is called by outlook, it indicates that the site has been deployed successfully,Then, you need to make careful debugging by referring to the precautions mentioned above.

The basic idea and steps for deploying IIS6 on Windows Server 2003 are similar, that is, pay attention to the settings of anonymous access permissions. When binding a self-signed certificate, it is different. To install the server certificate authority service, we recommend that you bind the server root certificate directly and then issue the root certificate to the client.

 

Summary

Through the development of OMS, we have not only gained a kind of extended service development method of outlook, but also gained familiarity with IIS and web site deployment. In practice, many problems are encountered, such as easily overlooked firewall settings and anonymous access permissions. You have time to learn about the network.

labor fruit, reprinted please indicate the source: http://www.cnblogs.com/P_Chou/archive/2011/01/13/oms-develop-deploy.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.