Which style of WSDL should I use?

本文探讨了Web Services Description Language (WSDL)中四种主要的绑定风格:RPC/encoded、RPC/literal、Document/encoded 和 Document/literal,并详细分析了它们各自的优缺点,特别是Document/literal wrapped风格的优势。

 
Document options
Set printer orientation to landscape mode

Print this page

Email this page

E-mail this page


developerWorks spaces

More options, more ways to get involved (coming soon)


Rate this page

Help us improve this content


Level: Advanced

Russell Butek (butek@us.ibm.com), SOA and Web services consultant, IBM

31 Oct 2003
Updated 24 May 2005

A Web Services Description Language (WSDL) binding style can be RPC or document. The use can be encoded or literal. How do you determine which combination of style and use to use? The author describes the WSDL and SOAP messages for each combination to help you decide.

Introduction

A WSDL document describes a Web service. A WSDL binding describes how the service is bound to a messaging protocol, particularly the SOAP messaging protocol. A WSDL SOAP binding can be either a Remote Procedure Call (RPC) style binding or a document style binding. A SOAP binding can also have an encoded use or a literal use. This gives you four style/use models:

  1. RPC/encoded
  2. RPC/literal
  3. Document/encoded
  4. Document/literal

Add to this collection a pattern which is commonly called the document/literal wrapped pattern and you have five binding styles to choose from when creating a WSDL file. Which one should you choose?

Before I go any further, let me clear up some confusion that many of us have stumbled over. The terminology here is very unfortunate: RPC versus document. These terms imply that the RPC style should be used for RPC programming models and that the document style should be used for document or messaging programming models. That is not the case at all. The style has nothing to do with a programming model. It merely dictates how to translate a WSDL binding to a SOAP message. Nothing more. You can use either style with any programming model.

Likewise, the terms encoded and literal are only meaningful for the WSDL-to-SOAP mapping, though, at least here, the traditional meanings of the words make a bit more sense.

For this discussion, let's start with the Java method in Listing 1 and apply the JAX-RPC Java-to-WSDL rules to it (see Resources for the JAX-RPC 1.1 specification).


Listing 1. Java method
public void myMethod(int x, float y);



Back to top


RPC/encoded

Take the method in Listing 1 and run it through your favorite Java-to-WSDL tool, specifying that you want it to generate RPC/encoded WSDL. You should end up with something like the WSDL snippet in Listing 2.


Listing 2. RPC/encoded WSDL for myMethod
<message name="myMethodRequest">
<part name="x" type="xsd:int"/>
<part name="y" type="xsd:float"/>
</message>
<message name="empty"/>

<portType name="PT">
<operation name="myMethod">
<input message="myMethodRequest"/>
<output message="empty"/>
</operation>
</portType>

<binding .../>
<!-- I won't bother with the details, just assume it's RPC/encoded. -->

Now invoke this method with "5" as the value for parameter x and "5.0" for parameter y. That sends a SOAP message which looks something like Listing 3.


Listing 3. RPC/encoded SOAP message for myMethod
<soap:envelope>
<soap:body>
<myMethod>
<x xsi:type="xsd:int">5</x>
<y xsi:type="xsd:float">5.0</y>
</myMethod>
</soap:body>
</soap:envelope>

A note about prefixes and namespaces

For the most part, for brevity, I ignore namespaces and prefixes in the listings in this article. I do use a few prefixes that you can assume are defined with the following namespaces:

  • xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  • xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

For a discussion about namespaces and the WSDL-to-SOAP mapping, see paper "Handle namespaces in SOAP messages you create by hand" (see Resources).

There are a number of things to notice about the WSDL and SOAP message for this RPC/encoded example:

Strengths

  • The WSDL is about as straightforward as it's possible for WSDL to be.
  • The operation name appears in the message, so the receiver has an easy time dispatching this message to the implementation of the operation.



Weaknesses

WS-I compliance

The various Web services specifications are sometimes inconsistent and unclear. The WS-I organization was formed to clear up the issues with the specs. It has defined a number of profiles which dictate how you should write your Web services to be interoperable. For more information on WS-I, see the WS-I links in Resources.

  • The type encoding info (such as xsi:type="xsd:int") is usually just overhead which degrades throughput performance.
  • You cannot easily validate this message since only the <x ...>5</x> and <y ...>5.0</y> lines contain things defined in a schema; the rest of the soap:body contents comes from WSDL definitions.
  • Although it is legal WSDL, RPC/encoded is not WS-I compliant.

Is there a way to keep the strengths and remove the weaknesses? Possibly. Let's look at the RPC/literal style.



Back to top


RPC/literal

The RPC/literal WSDL for this method looks almost the same as the RPC/encoded WSDL (see Listing 4). The use in the binding is changed from encoded to literal. That's it.


Listing 4. RPC/literal WSDL for myMethod
<message name="myMethodRequest">
<part name="x" type="xsd:int"/>
<part name="y" type="xsd:float"/%gt;
</message>
<message name="empty"/>

<portType name="PT">
<operation name="myMethod">
<input message="myMethodRequest"/>
<output message="empty"/>
</operation>
</portType>

<binding .../>
<!-- I won't bother with the details, just assume it's RPC/literal. -->

What about the SOAP message for RPC/literal (see Listing 5)? Here there is a bit more of a change. The type encodings have been removed.


Listing 5. RPC/literal SOAP message for myMethod
<soap:envelope>
<soap:body>
<myMethod>
<x>5</x>
<y>5.0</y>
</myMethod>
</soap:body>
</soap:envelope>

A note about xsi:type and literal use

Although in normal circumstances xsi:type does not appear in a literal WSDL's SOAP message, there are still cases when type information is necessary and it will appear -- in polymorphism, for instance. If the API expects a base type and an extension instance is sent, the type of that instance must be provided for proper deserialization of the object.

Here are the strengths and weaknesses of this approach:

Strengths

  • The WSDL is still about as straightforward as it is possible for WSDL to be.
  • The operation name still appears in the message.
  • The type encoding info is eliminated.
  • RPC/literal is WS-I compliant.

Weaknesses

  • You still cannot easily validate this message since only the <x ...>5</x> and <y ...>5.0</y> lines contain things defined in a schema; the rest of the soap:body contents comes from WSDL definitions.

What about the document styles? Do they help overcome this weakness?



Back to top


Document/encoded

Nobody follows this style. It is not WS-I compliant. So let's move on.



Back to top


Document/literal

The WSDL for document/literal changes somewhat from the WSDL for RPC/literal. The differences are highlighted in bold in Listing 6.


Listing 6. Document/literal WSDL for myMethod
				<types>
<schema>
<element name="xElement" type="xsd:int"/>
<element name="yElement" type="xsd:float"/>
</schema>
</types>


<message name="myMethodRequest">
<part name="x" element="xElement"/>
<part name="y" element="yElement"/>
</message>
<message name="empty"/>

<portType name="PT">
<operation name="myMethod">
<input message="myMethodRequest"/>
<output message="empty"/>
</operation>
</portType>

<binding .../>
<!-- I won't bother with the details, just assume it's document/literal. -->

The SOAP message for this WSDL is in Listing 7:


Listing 7. Document/literal SOAP message for myMethod
<soap:envelope>
<soap:body>
<xElement>5</xElement>
<yElement>5.0</yElement>
</soap:body>
</soap:envelope>

A note about the message part

I could have changed only the binding, as I did from RPC/encoded to RPC/literal. It would have been legal WSDL. However, the WS-I Basic Profile dictates that document/literal message parts refer to elements rather than types, so I'm complying with WS-I. (And using an element part here leads well into the discussion about the document/literal wrapped pattern.)

Here are the strengths and weaknesses of this approach:

Strengths

  • There is no type encoding info.
  • You can finally validate this message with any XML validator. Everything within the soap:body is defined in a schema.
  • Document/literal is WS-I compliant, but with restrictions (see weaknesses).

Weaknesses

  • The WSDL is getting a bit more complicated. This is a very minor weakness, however, since WSDL is not meant to be read by humans.
  • The operation name in the SOAP message is lost. Without the name, dispatching can be difficult, and sometimes impossible.
  • WS-I only allows one child of the soap:body in a SOAP message. As you can see in Listing 7, this example's soap:body has two children.

The document/literal style seems to have merely rearranged the strengths and weaknesses from the RPC/literal model. You can validate the message, but you lose the operation name. Is there anything you can do to improve upon this? Yes. It's called the document/literal wrapped pattern.



Back to top


Document/literal wrapped

Before I describe the rules for the document/literal wrapped pattern, let me show you the WSDL and the SOAP message in Listing 8 and Listing 9.


Listing 8. Document/literal wrapped WSDL for myMethod
<types>
<schema>
<element name="myMethod">
<complexType>
<sequence>
<element name="x" type="xsd:int"/>
<element name="y" type="xsd:float"/>
</sequence>
</complexType>
</element>
<element name="myMethodResponse">
<complexType/>
</element>

</schema>
</types>
<message name="myMethodRequest">
<part name="parameters" element="myMethod"/>
</message>
<message name="empty">
<part name="parameters" element="myMethodResponse"/>
</message>


<portType name="PT">
<operation name="myMethod">
<input message="myMethodRequest"/>
<output message="empty"/>
</operation>
</portType>

<binding .../>
<!-- I won't bother with the details, just assume it's document/literal. -->

The WSDL schema now has a wrapper around the parameters (see Listing 9).


Listing 9. Document/literal wrapped SOAP message for myMethod
<soap:envelope>
<soap:body>
<myMethod>
<x>5</x>
<y>5.0</y>
</myMethod>
</soap:body>
</soap:envelope>

Notice that this SOAP message looks remarkably like the RPC/literal SOAP message in Listing 5. You might say it looks exactly like the RPC/literal SOAP message, but there's a subtle difference. In the RPC/literal SOAP message, the <myMethod> child of <soap:body> was the name of the operation. In the document/literal wrapped SOAP message, the <myMethod> clause is the name of the wrapper element which the single input message's part refers to. It just so happens that one of the characteristics of the wrapped pattern is that the name of the input element is the same as the name of the operation. This pattern is a sly way of putting the operation name back into the SOAP message.

These are the basic characteristics of the document/literal wrapped pattern:

  • The input message has a single part.
  • The part is an element.
  • The element has the same name as the operation.
  • The element's complex type has no attributes.

Here are the strengths and weaknesses of this approach:

Strengths

  • There is no type encoding info.
  • Everything that appears in the soap:body is defined by the schema, so you can easily validate this message.
  • Once again, you have the method name in the SOAP message.
  • Document/literal is WS-I compliant, and the wrapped pattern meets the WS-I restriction that the SOAP message's soap:body has only one child.

Weaknesses

  • The WSDL is even more complicated.

As you can see, there is still a weakness with the document/literal wrapped pattern, but it's minor and far outweighed by the strengths.

RPC/literal wrapped?

From a WSDL point of view, there's no reason the wrapped pattern is tied only to document/literal bindings. It could just as easily be applied to an RPC/literal binding. But this would be rather silly. The SOAP message would contain a myMethod element for the operation and a child myMethod element for the element name. Also, even though it's legal WSDL, an RPC/literal part should be a type; an element part is not WS-I compliant.

Where is doc/lit wrapped defined?

This wrapped style originates from Microsoft®. There is no specification that defines this style; so while this style is a good thing, unfortunately, the only choice right now, in order to interoperate with Microsoft's and other's implementations, is to make educated guesses as to how it works based on the output of the Microsoft WSDL generator. This pattern has been around for awhile, and the industry has done a good job of understanding it, but while the pattern is fairly obvious in this example, there are corner cases in which the proper thing to do is not particularly clear. Our best hope is that an independent group like the WS-I organization will help stabilize and standardize this in the future.



Back to top


Why not use document/literal wrapped all the time?

So far, this article has given the impression that the document/literal wrapped style is the best approach. Very often that's true. But there are still cases where you'd be better off using another style.

Reasons to use document/literal non-wrapped

If you have overloaded operations, you cannot use the document/literal wrapped style.

Imagine that, along with the method you've been using all along, you have the additional method in Listing 10.


Listing 10. Problem methods for document/literal wrapped
public void myMethod(int x, float y);
public void myMethod(int x);

A note about overloaded operations

WSDL 2.0 will not allow overloaded operations. This is unfortunate for languages like the Java language which do allow them. Specs like JAX-RPC will have to define a name mangling scheme to map overloaded methods to WSDL. WSDL 2.0 merely moves the problem from the WSDL-to-SOAP mapping to the WSDL-to-language mapping.

WSDL allows overloaded operations. But when you add the wrapped pattern to WSDL, you require an element to have the same name as the operation, and you cannot have two elements with the same name in XML. So you must use the document/literal, non-wrapped style or one of the RPC styles.

Reasons to use RPC/literal

Since the document/literal, non-wrapped style doesn't provide the operation name, there are cases where you'll need to use one of the RPC styles. For instance, say you have the set of methods in Listing 11.






Listing 11. Problem methods for document/literal non-wrapped
public void myMethod(int x, float y);
public void myMethod(int x);
public void someOtherMethod(int x, float y);

Now assume that your server receives the document/literal SOAP message that you saw back in Listing 7. Which method should the server dispatch to? All you know for sure is that it's not myMethod(int x) because the message has two parameters and this method requires one. It could be either of the other two methods. With the document/literal style, you have no way to know which one.

Instead of the document/literal message, assume that the server receives an RPC/literal message such as the one in Listing 5. With this message it's fairly easy for a server to decide which method to dispatch to. You know the operation name is myMethod, and you know you have two parameters, so it must be myMethod(int x, float y).

Reasons to use RPC/encoded

The primary reason to prefer the RPC/encoded style is for data graphs. Imagine that you have a binary tree whose nodes are defined in Listing 12.


Listing 12. Binary tree node schema
<complexType name="Node">
<sequence>
<element name="name" type="xsd:string"/>
<element name="left" type="Node" xsd:nillable="true"/>
<element name="right" type="Node" xsd:nillable="true"/>
</sequence>
</complexType>

With this node definition, you could construct a tree whose root node -- A -- points to node B through both its left and right links (see Figure 1).


Figure 1. Encoded tree.
Encoded tree

The standard way to send data graphs is to use the href tag, which is part of the RPC/encoded style (Listing 13).


Listing 13. The RPC/encoded binary tree
<A>
<name>A</name>
<left href="12345"/>
<right href="12345"/>
</A>
<B id="12345">
<name>B</name>
<left xsi:nil="true"/>
<right xsi:nil="true"/>
</B>

Under any literal style, the href attribute is not available, so the graph linkage is lost (see Listing 14 and Figure 2). You still have a root node, A, which points to a node B to the left and another node B to the right. These B nodes are equal, but they are not the same node. Data have been duplicated instead of being referenced twice.


Listing 14. The literal binary tree
<A>
<name>A</name>
<left>
<name>B</name>
<left xsi:nil="true"/>
<right xsi:nil="true"/>
</left>
<right>
<name>B</name>
<left xsi:nil="true"/>
<right xsi:nil="true"/>
</right>
</A>


Figure 2. Literal tree
Literal tree

There are various ways you can do graphs in literal styles, but there are no standard ways; so anything you might do would probably not interoperate with the service on the other end of the wire.



Back to top


SOAP response messages

So far I have been discussing request messages. But what about response messages? What do they look like? By now it should be clear to you what the response message looks like for a document/literal message. The contents of the soap:body are fully defined by a schema, so all you have to do is look at the schema to know what the response message looks like. For instance, see Listing 15 for the response for the WSDL in Listing 8.


Listing 15. document/literal wrapped response SOAP message for myMethod
<soap:envelope>
<soap:body>
<myMethodResponse/>
</soap:body>
</soap:envelope>

But what is the child of the soap:body for the RPC style responses? The WSDL 1.1 specification is not clear. But WS-I comes to the rescue. WS-I's Basic Profile dictates that in the RPC/literal response message, the name of the child of soap:body is "... the corresponding wsdl:operation name suffixed with the string 'Response'." Surprise! That's exactly what the conventional wrapped pattern's response element is called. So Listing 15 applies to the RPC/literal message as well as the document/literal wrapped message. (Since RPC/encoded is not WS-I compliant, the WS-I Basic Profile doesn't mention what an RPC/encoded response looks like, but you can assume the same convention applies here that applies everywhere else.) So the contents of response messages are not so mysterious after all.



Back to top


Summary

There are four binding styles (there are really five, but document/encoded is meaningless). While each style has its place, under most situations the best style is document/literal wrapped.



Resources



About the author

Russell Butek is an SOA and Web services consultant for IBM. He has been one of the developers of IBM WebSphere Web services engine. He has also been a member the JAX-RPC Java Specification Request (JSR) expert group. He was involved in the implementation of Apache's AXIS SOAP engine, driving AXIS 1.0 to comply with JAX-RPC 1.0.

 
profile M和profile G在以下这个函数上的区别GetProfiles Description: Retrieve the profile with the specified token or all defined media profiles. If no Type is provided the returned profiles shall contain no configuration information. If a single Type with value 'All' is provided the returned profiles shall include all associated configurations. Otherwise the requested list of configurations shall for each profile include the configurations present as Type. SOAP action: http://www.onvif.org/ver20/media/wsdl/GetProfiles Input: [GetProfiles] Token - optional; [ReferenceToken] Optional token of the requested profile. Type - optional, unbounded; [string] The types shall be provided as defined by tr2:ConfigurationEnumeration. Output: [GetProfilesResponse] Profiles - optional, unbounded; [MediaProfile] Lists all profiles that exist in the media service. The response provides the requested types of Configurations as far as available. If a profile doesn't contain a type no error shall be provided. token - required; [ReferenceToken] Unique identifier of the profile. fixed [boolean] A value of true signals that the profile cannot be deleted. Default is false. Name [Name] User readable name of the profile. Configurations - optional; [ConfigurationSet] The configurations assigned to the profile. VideoSource - optional; [VideoSourceConfiguration] Optional configuration of the Video input. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. ViewMode [string] Readonly parameter signalling Source configuration's view mode, for devices supporting different view modes as defined in tt:viewModes. SourceToken [ReferenceToken] Reference to the physical input. Bounds [IntRectangle] Rectangle specifying the Video capturing area. The capturing area shall not be larger than the whole Video source area. x - required; [int] y - required; [int] width - required; [int] height - required; [int] Extension - optional; [VideoSourceConfigurationExtension] Rotate - optional; [Rotate] Optional element to configure rotation of captured image. What resolutions a device supports shall be unaffected by the Rotate parameters. If a device is configured with Rotate=AUTO, the device shall take control over the Degree parameter and automatically update it so that a client can query current rotation. The device shall automatically apply the same rotation to its pan/tilt control direction depending on the following condition: if Reverse=AUTO in PTControlDirection or if the device doesn’t support Reverse in PTControlDirection Mode [RotateMode] Parameter to enable/disable Rotation feature. - enum { 'OFF', 'ON', 'AUTO' } Degree - optional; [int] Optional parameter to configure how much degree of clockwise rotation of image for On mode. Omitting this parameter for On mode means 180 degree rotation. Extension - optional; [RotateExtension] Extension - optional; [VideoSourceConfigurationExtension2] LensDescription - optional, unbounded; [LensDescription] Optional element describing the geometric lens distortion. Multiple instances for future variable lens support. FocalLength [float] Optional focal length of the optical system. Offset [LensOffset] Offset of the lens center to the imager center in normalized coordinates. x [float] Optional horizontal offset of the lens center in normalized coordinates. y [float] Optional vertical offset of the lens center in normalized coordinates. Projection - unbounded; [LensProjection] Radial description of the projection characteristics. The resulting curve is defined by the B-Spline interpolation over the given elements. The element for Radius zero shall not be provided. The projection points shall be ordered with ascending Radius. Items outside the last projection Radius shall be assumed to be invisible (black). Angle [float] Angle of incidence. Radius [float] Mapping radius as a consequence of the emergent angle. Transmittance - optional; [float] Optional ray absorption at the given angle due to vignetting. A value of one means no absorption. XFactor [float] Compensation of the x coordinate needed for the ONVIF normalized coordinate system. SceneOrientation - optional; [SceneOrientation] Optional element describing the scene orientation in the camera’s field of view. Mode [SceneOrientationMode] Parameter to assign the way the camera determines the scene orientation. - enum { 'MANUAL', 'AUTO' } Orientation - optional; [string] Assigned or determined scene orientation based on the Mode. When assigning the Mode to AUTO, this field is optional and will be ignored by the device. When assigning the Mode to MANUAL, this field is required and the device will return an InvalidArgs fault if missing. AudioSource - optional; [AudioSourceConfiguration] Optional configuration of the Audio input. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. SourceToken [ReferenceToken] Token of the Audio Source the configuration applies to VideoEncoder - optional; [VideoEncoder2Configuration] Optional configuration of the Video encoder. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. GovLength [int] Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames. AnchorFrameDistance [int] Distance between anchor frames of type I-Frame and P-Frame. '1' indicates no B-Frames, '2' indicates that every 2nd frame is encoded as B-Frame, '3' indicates a structure like IBBPBBP..., etc. Profile [string] The encoder profile as defined in tt:VideoEncodingProfiles. GuaranteedFrameRate [boolean] A value of true indicates that frame rate is a fixed value rather than an upper limit, and that the video encoder shall prioritize frame rate over all other adaptable configuration values such as bitrate. Default is false. Signed [boolean] Indicates if this stream will be signed according to the Media Signing Specification. Encoding [string] Video Media Subtype for the video format. For definitions see tt:VideoEncodingMimeNames and IANA Media Types. Resolution [VideoResolution2] Configured video resolution Width [int] Number of the columns of the Video image. If there is a 90-degree rotation, this represents the number of lines of the Video image. Height [int] Number of the lines of the Video image. If there is a 90-degree rotation, this represents the number of columns of the Video image. RateControl - optional; [VideoRateControl2] Optional element to configure rate control related parameters. ConstantBitRate [boolean] Enforce constant bitrate. FrameRateLimit [float] Desired frame rate in fps. The actual rate may be lower due to e.g. performance limitations. BitrateLimit [int] the maximum output bitrate in kbps Multicast - optional; [MulticastConfiguration] Defines the multicast settings that could be used for video streaming. Address [IPAddress] The multicast address (if this address is set to 0 no multicast streaming is enaled) Type [IPType] Indicates if the address is an IPv4 or IPv6 address. - enum { 'IPv4', 'IPv6' } IPv4Address - optional; [IPv4Address] IPv4 address. IPv6Address - optional; [IPv6Address] IPv6 address Port [int] The RTP mutlicast destination port. A device may support RTCP. In this case the port value shall be even to allow the corresponding RTCP stream to be mapped to the next higher (odd) destination port number as defined in the RTSP specification. TTL [int] In case of IPv6 the TTL value is assumed as the hop limit. Note that for IPV6 and administratively scoped IPv4 multicast the primary use for hop limit / TTL is to prevent packets from (endlessly) circulating and not limiting scope. In these cases the address contains the scope. AutoStart [boolean] Read only property signalling that streaming is persistant. Use the methods StartMulticastStreaming and StopMulticastStreaming to switch its state. Quality [float] Relative value for the video quantizers and the quality of the video. A high value within supported quality range means higher quality AudioEncoder - optional; [AudioEncoder2Configuration] Optional configuration of the Audio encoder. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. Encoding [string] Audio Media Subtype for the audio format. For definitions see tt:AudioEncodingMimeNames and IANA Media Types. Multicast - optional; [MulticastConfiguration] Optional multicast configuration of the audio stream. Address [IPAddress] The multicast address (if this address is set to 0 no multicast streaming is enaled) Type [IPType] Indicates if the address is an IPv4 or IPv6 address. - enum { 'IPv4', 'IPv6' } IPv4Address - optional; [IPv4Address] IPv4 address. IPv6Address - optional; [IPv6Address] IPv6 address Port [int] The RTP mutlicast destination port. A device may support RTCP. In this case the port value shall be even to allow the corresponding RTCP stream to be mapped to the next higher (odd) destination port number as defined in the RTSP specification. TTL [int] In case of IPv6 the TTL value is assumed as the hop limit. Note that for IPV6 and administratively scoped IPv4 multicast the primary use for hop limit / TTL is to prevent packets from (endlessly) circulating and not limiting scope. In these cases the address contains the scope. AutoStart [boolean] Read only property signalling that streaming is persistant. Use the methods StartMulticastStreaming and StopMulticastStreaming to switch its state. Bitrate [int] The output bitrate in kbps. SampleRate [int] The output sample rate in kHz. Analytics - optional; [VideoAnalyticsConfiguration] Optional configuration of the analytics module and rule engine. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. AnalyticsEngineConfiguration [AnalyticsEngineConfiguration] AnalyticsModule - optional, unbounded; [Config] Name - required; [string] Name of the configuration. Type - required; [QName] The Type attribute specifies the type of rule and shall be equal to value of one of Name attributes of ConfigDescription elements returned by GetSupportedRules and GetSupportedAnalyticsModules command. Parameters [ItemList] List of configuration parameters as defined in the corresponding description. SimpleItem - optional, unbounded; Value name pair as defined by the corresponding description. Name - required; [string] Item name. Value - required; [anySimpleType] Item value. The type is defined in the corresponding description. ElementItem - optional, unbounded; Complex value structure. Name - required; [string] Item name. Extension - optional; [ItemListExtension] Extension - optional; [AnalyticsEngineConfigurationExtension] RuleEngineConfiguration [RuleEngineConfiguration] Rule - optional, unbounded; [Config] Name - required; [string] Name of the configuration. Type - required; [QName] The Type attribute specifies the type of rule and shall be equal to value of one of Name attributes of ConfigDescription elements returned by GetSupportedRules and GetSupportedAnalyticsModules command. Parameters [ItemList] List of configuration parameters as defined in the corresponding description. SimpleItem - optional, unbounded; Value name pair as defined by the corresponding description. Name - required; [string] Item name. Value - required; [anySimpleType] Item value. The type is defined in the corresponding description. ElementItem - optional, unbounded; Complex value structure. Name - required; [string] Item name. Extension - optional; [ItemListExtension] Extension - optional; [RuleEngineConfigurationExtension] PTZ - optional; [PTZConfiguration] Optional configuration of the pan tilt zoom unit. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. MoveRamp [int] The optional acceleration ramp used by the device when moving. PresetRamp [int] The optional acceleration ramp used by the device when recalling presets. PresetTourRamp [int] The optional acceleration ramp used by the device when executing PresetTours. NodeToken [ReferenceToken] A mandatory reference to the PTZ Node that the PTZ Configuration belongs to. DefaultAbsolutePantTiltPositionSpace - optional; [anyURI] If the PTZ Node supports absolute Pan/Tilt movements, it shall specify one Absolute Pan/Tilt Position Space as default. DefaultAbsoluteZoomPositionSpace - optional; [anyURI] If the PTZ Node supports absolute zoom movements, it shall specify one Absolute Zoom Position Space as default. DefaultRelativePanTiltTranslationSpace - optional; [anyURI] If the PTZ Node supports relative Pan/Tilt movements, it shall specify one RelativePan/Tilt Translation Space as default. DefaultRelativeZoomTranslationSpace - optional; [anyURI] If the PTZ Node supports relative zoom movements, it shall specify one Relative Zoom Translation Space as default. DefaultContinuousPanTiltVelocitySpace - optional; [anyURI] If the PTZ Node supports continuous Pan/Tilt movements, it shall specify one Continuous Pan/Tilt Velocity Space as default. DefaultContinuousZoomVelocitySpace - optional; [anyURI] If the PTZ Node supports continuous zoom movements, it shall specify one Continuous Zoom Velocity Space as default. DefaultPTZSpeed - optional; [PTZSpeed] If the PTZ Node supports absolute or relative PTZ movements, it shall specify corresponding default Pan/Tilt and Zoom speeds. PanTilt - optional; [Vector2D] Pan and tilt speed. The x component corresponds to pan and the y component to tilt. If omitted in a request, the current (if any) PanTilt movement should not be affected. Zoom - optional; [Vector1D] A zoom speed. If omitted in a request, the current (if any) Zoom movement should not be affected. DefaultPTZTimeout - optional; [duration] If the PTZ Node supports continuous movements, it shall specify a default timeout, after which the movement stops. PanTiltLimits - optional; [PanTiltLimits] The Pan/Tilt limits element should be present for a PTZ Node that supports an absolute Pan/Tilt. If the element is present it signals the support for configurable Pan/Tilt limits. If limits are enabled, the Pan/Tilt movements shall always stay within the specified range. The Pan/Tilt limits are disabled by setting the limits to –INF or +INF. Range [Space2DDescription] A range of pan tilt limits. URI [anyURI] A URI of coordinate systems. XRange [FloatRange] A range of x-axis. Min [float] Max [float] YRange [FloatRange] A range of y-axis. Min [float] Max [float] ZoomLimits - optional; [ZoomLimits] The Zoom limits element should be present for a PTZ Node that supports absolute zoom. If the element is present it signals the supports for configurable Zoom limits. If limits are enabled the zoom movements shall always stay within the specified range. The Zoom limits are disabled by settings the limits to -INF and +INF. Range [Space1DDescription] A range of zoom limit URI [anyURI] A URI of coordinate systems. XRange [FloatRange] A range of x-axis. Min [float] Max [float] Extension - optional; [PTZConfigurationExtension] PTControlDirection - optional; [PTControlDirection] Optional element to configure PT Control Direction related features. EFlip - optional; [EFlip] Optional element to configure related parameters for E-Flip. Mode [EFlipMode] Parameter to enable/disable E-Flip feature. - enum { 'OFF', 'ON', 'Extended' } Reverse - optional; [Reverse] Optional element to configure related parameters for reversing of PT Control Direction. Mode [ReverseMode] Parameter to enable/disable Reverse feature. - enum { 'OFF', 'ON', 'AUTO', 'Extended' } Extension - optional; [PTControlDirectionExtension] Extension - optional; [PTZConfigurationExtension2] Metadata - optional; [MetadataConfiguration] Optional configuration of the metadata stream. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. CompressionType [string] Optional parameter to configure compression type of Metadata payload. Use values from enumeration MetadataCompressionType. GeoLocation [boolean] Optional parameter to configure if the metadata stream shall contain the Geo Location coordinates of each target. ShapePolygon [boolean] Optional parameter to configure if the generated metadata stream should contain shape information as polygon. PTZStatus - optional; [PTZFilter] optional element to configure which PTZ related data is to include in the metadata stream Status [boolean] True if the metadata stream shall contain the PTZ status (IDLE, MOVING or UNKNOWN) Position [boolean] True if the metadata stream shall contain the PTZ position FieldOfView - optional; [boolean] True if the metadata stream shall contain the field-of-view information Events - optional; [EventSubscription] Optional element to configure the streaming of events. A client might be interested in receiving all, none or some of the events produced by the device: To get all events: Include the Events element but do not include a filter. To get no events: Do not include the Events element. To get only some events: Include the Events element and include a filter in the element. Filter - optional; [FilterType] SubscriptionPolicy - optional; Analytics - optional; [boolean] Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) Multicast [MulticastConfiguration] Defines the multicast settings that could be used for video streaming. Address [IPAddress] The multicast address (if this address is set to 0 no multicast streaming is enaled) Type [IPType] Indicates if the address is an IPv4 or IPv6 address. - enum { 'IPv4', 'IPv6' } IPv4Address - optional; [IPv4Address] IPv4 address. IPv6Address - optional; [IPv6Address] IPv6 address Port [int] The RTP mutlicast destination port. A device may support RTCP. In this case the port value shall be even to allow the corresponding RTCP stream to be mapped to the next higher (odd) destination port number as defined in the RTSP specification. TTL [int] In case of IPv6 the TTL value is assumed as the hop limit. Note that for IPV6 and administratively scoped IPv4 multicast the primary use for hop limit / TTL is to prevent packets from (endlessly) circulating and not limiting scope. In these cases the address contains the scope. AutoStart [boolean] Read only property signalling that streaming is persistant. Use the methods StartMulticastStreaming and StopMulticastStreaming to switch its state. SessionTimeout [duration] The rtsp session timeout for the related audio stream (when using Media2 Service, this value is deprecated and ignored) AnalyticsEngineConfiguration - optional; [AnalyticsEngineConfiguration] Indication which AnalyticsModules shall output metadata. Note that the streaming behavior is undefined if the list includes items that are not part of the associated AnalyticsConfiguration. AnalyticsModule - optional, unbounded; [Config] Name - required; [string] Name of the configuration. Type - required; [QName] The Type attribute specifies the type of rule and shall be equal to value of one of Name attributes of ConfigDescription elements returned by GetSupportedRules and GetSupportedAnalyticsModules command. Parameters [ItemList] List of configuration parameters as defined in the corresponding description. SimpleItem - optional, unbounded; Value name pair as defined by the corresponding description. Name - required; [string] Item name. Value - required; [anySimpleType] Item value. The type is defined in the corresponding description. ElementItem - optional, unbounded; Complex value structure. Name - required; [string] Item name. Extension - optional; [ItemListExtension] Extension - optional; [AnalyticsEngineConfigurationExtension] Extension - optional; [MetadataConfigurationExtension] AudioOutput - optional; [AudioOutputConfiguration] Optional configuration of the Audio output. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. OutputToken [ReferenceToken] Token of the phsycial Audio output. SendPrimacy - optional; [anyURI] An audio channel MAY support different types of audio transmission. While for full duplex operation no special handling is required, in half duplex operation the transmission direction needs to be switched. The optional SendPrimacy parameter inside the AudioOutputConfiguration indicates which direction is currently active. An NVC can switch between different modes by setting the AudioOutputConfiguration. The following modes for the Send-Primacy are defined: www.onvif.org/ver20/HalfDuplex/Server The server is allowed to send audio data to the client. The client shall not send audio data via the backchannel to the NVT in this mode. www.onvif.org/ver20/HalfDuplex/Client The client is allowed to send audio data via the backchannel to the server. The NVT shall not send audio data to the client in this mode. www.onvif.org/ver20/HalfDuplex/Auto It is up to the device how to deal with sending and receiving audio data. Acoustic echo cancellation is out of ONVIF scope. OutputLevel [int] Volume setting of the output. The applicable range is defined via the option AudioOutputOptions.OutputLevelRange. AudioDecoder - optional; [AudioDecoderConfiguration] Optional configuration of the Audio decoder. token - required; [ReferenceToken] Token that uniquely references this configuration. Length up to 64 characters. Name [Name] User readable name. Length up to 64 characters. UseCount [int] Number of internal references currently using this configuration. This informational parameter is read-only. Deprecated for Media2 Service. Receiver - optional; [ReceiverConfiguration] Optional configuration of the Receiver. Mode [ReceiverMode] The following connection modes are defined: - AutoConnect: The receiver connects on demand, as required by consumers of the media streams. - AlwaysConnect: The receiver attempts to maintain a persistent connection to the configured endpoint. - NeverConnect: The receiver does not attempt to connect. - Unknown: This case should never happen. MediaUri [anyURI] Details of the URI to which the receiver should connect. StreamSetup [StreamSetup] Stream connection parameters. Stream [StreamType] Defines if a multicast or unicast stream is requested - enum { 'RTP-Unicast', 'RTP-Multicast' } Transport [Transport] Protocol [TransportProtocol] Defines the network protocol for streaming, either UDP=RTP/UDP, RTSP=RTP/RTSP/TCP or HTTP=RTP/RTSP/HTTP/TCP - enum { 'UDP', 'TCP', 'RTSP', 'HTTP' } Tunnel - optional; [Transport] Optional element to describe further tunnel options. This element is normally not needed Protocol [TransportProtocol] Defines the network protocol for streaming, either UDP=RTP/UDP, RTSP=RTP/RTSP/TCP or HTTP=RTP/RTSP/HTTP/TCP - enum { 'UDP', 'TCP', 'RTSP', 'HTTP' } Tunnel - optional; [Transport] Optional element to describe further tunnel options. This element is normally not needed ... is recursive token [ReferenceToken]
09-19
我前面已经给你发了httpd模块和onvif模块中与GROUP_ONVIF_HTTPS(我新添加的服务组)相关的代码,包括httpd.c、httpd.h、http_utils.c、http_parser.c、onvif_srv.c、soap_pack.c、soap_event.c、soap_tev.c、soap_tds.c,onvif模块原来只支持http,不支持https,但是我给它添加了onvif over https支持,将请求中带“/onvif”路径的传递到onvif模块进行相应处理,由于我的修改有问题,导致虽然其他接口都正常,但是事件订阅部分功能出问题,目前我在使用onvif官方测试工具进行测试时,发现了2个bug: 1、事件服务测real_time_pull_point notification interface接口时一直报错"the operation is only allowed use a successtully aauthenticated context" 测试信息如下: EVENT-3-1-15-v14.12 REALTIME PULLPOINT SUBSCRIPTION - PULLMESSAGES STEP 1 - Get Event service address StepStart: 2025-10-22T08:04:55.5586171Z Transmit done Receive done STEP PASSED STEP 2 - Get Event Properties StepStart: 2025-10-22T08:04:55.8650364Z Transmit done Receive done STEP PASSED Timeout of 60 seconds will be used STEP 3 - Create Pull Point Subscription StepStart: 2025-10-22T08:04:56.1667107Z Transmit done Receive done STEP PASSED STEP 4 - Check that TerminationTime is specified StepStart: 2025-10-22T08:04:56.3664914Z STEP PASSED STEP 5 - Check that TerminationTime and CurrentTime has reasonable values StepStart: 2025-10-22T08:04:56.3679861Z STEP PASSED STEP 6 - Validate CurrentTime and TerminationTime StepStart: 2025-10-22T08:04:56.3692768Z STEP PASSED STEP 7 - Check if the DUT returned SubscriptionReference StepStart: 2025-10-22T08:04:56.3705465Z STEP PASSED STEP 8 - Check if SubscriptionReference contains address StepStart: 2025-10-22T08:04:56.371947Z STEP PASSED STEP 9 - Check that URL specified is valid StepStart: 2025-10-22T08:04:56.3736841Z STEP PASSED STEP 10 - Send PullMessages request StepStart: 2025-10-22T08:04:56.3798843Z This operation is only allowed using a successfully authenticated context. STEP FAILED STEP 11 - Delete Subscription Manager StepStart: 2025-10-22T08:04:56.4714134Z Send unsubscribe request Failed to unsubscribe through request. Error received: This operation is only allowed using a successfully authenticated context. Wait until Subscription Manager is deleted by timeout STEP PASSED TEST FAILED 协议规范: Test Case ID: EVENT-3-1-15 Specification Coverage: CreatePullPointSubscription, SetSynchronizationPoint, PullMessages Feature Under Test: CreatePullPointSubscription, SetSynchronizationPoint, PullMessages WSDL Reference: event.wsdl Test Purpose: To verify PullMessages command Pre-Requisite: Event Service is supported by the DUT. Device supports Pull-Point Notification feature. The DUT shall provide at least one event. The test operator has to ensure that the event is triggered and sent out. ONVIF Client will invoke a SetSynchronizationPoint request. If the device does not support property events or if it is not possible to invoke a SetSynchronizationPoint, the test operator has to trigger event manually. Test Configuration: ONVIF Client and DUT Test Procedure: Start an ONVIF Client. Start the DUT. ONVIF Client will invoke CreatePullPointSubscription request with a suggested timeout of PT60S. Verify that the DUT sends a CreatePullPointSubscriptionResponse message. Validate that correct values for CurrentTime and TerminationTime and SubscriptionReference are returned. ONVIF Client will invoke PullMessages command with a PullMessagesTimeout of 20s and a MessageLimit of 2. ONVIF Client will invoke SetSynchronizationPoint request to trigger an event. Verify that the DUT sends a SetSynchronizationPointResponse message. If the DUT does not support property events, the operator has to trigger an event manually. Verify that the DUT sends a PullMessagesResponse that contains at least one NotificationMessage that represents a property. Verify NotificationMessage (a maximum number of 2 Notification Messages is included in the PullMessagesResponse message; well formed and valid values for CurrentTime and TerminationTime (TerminationTime > CurrentTime). Test Result: PASS – DUT passes all assertions. FAIL – The DUT did not send CreatePullPointSubscriptionResponse message. The DUT did not send valid values for CurrentTime and TerminationTime (TerminationTime > CurrentTime). The DUT did not send a SetSynchronizationPointResponse message. The DUT did not send a PullMessagesResponse message. The PullMessagesResponse message does not contain a NotificationMessage. The PullMessagesResponse message contains more than 2 NotificationMessages. The NotificationMessages are not well formed. The PullMessagesResponse message contains invalid values for Current or TerminationTime. The DUT did not send a PullMessagesFaultResponse message. The DUT did not send valid WS-Addressing Action URI in SOAP Header for CreatePullPointSubscriptionResponse message (see [Annex A.3](file:///D:/New Folder/Docs/Specifications/EVENT.html#Annex_ActionURIsForEventServiceMessages)). The DUT did not send valid WS-Addressing Action URI in SOAP Header for SetSynchronizationPointResponse message (see [Annex A.3](file:///D:/New Folder/Docs/Specifications/EVENT.html#Annex_ActionURIsForEventServiceMessages)). The DUT did not send valid WS-Addressing Action URI in SOAP Header for PullMessagesResponse message (see [Annex A.3](file:///D:/New Folder/Docs/Specifications/EVENT.html#Annex_ActionURIsForEventServiceMessages)). Note: The Subscription Manager has to be deleted at the end of the test either by calling unsubscribe or through a timeout. Note: It may be possible that some other events than the event which is being verified will be sent as PullMessages response during this test case. In such case, ONVIF Client should simply discard such response and they retry PullMessages request for the very event for verification. Note: During test case execution, it should be guaranteed that the DUT should not delete the property event which is being used for verification. Note: If DUT cannot accept the set value to Timeout or MessageLimit, ONVIF Client retries to send the PullMessage message with Timeout and MessageLimit which is contained in PullMessagesFaultResponse message. Note: See [Annex A.1](file:///D:/New Folder/Docs/Specifications/EVENT.html#Annex_subscribe_example) for instructions on how to construct Subscribe when it is required for the ONVIF Client to receive all events supported by the DUT. 2、basic notification interface接口测试时报错“The HTTP request has exceeded the allotted timeout” 测试信息如下: EVENT-2-1-9-v14.12 BASIC NOTIFICATION INTERFACE - SUBSCRIBE STEP 1 - Get Event service address StepStart: 2025-10-22T08:08:20.8360075Z Transmit done Receive done STEP PASSED STEP 2 - Creating listening server StepStart: 2025-10-22T08:08:24.2967735Z STEP PASSED STEP 3 - Send Subscribe request StepStart: 2025-10-22T08:08:24.3040478Z Transmit done The HTTP request has exceeded the allotted timeout STEP FAILED TEST FAILED 协议规范: Test Case ID: EVENT-2-1-9 Specification Coverage: Basic Notification Interface Feature Under Test: Subscribe WSDL Reference: event.wsdl Test Purpose: To verify DUT Subscribe command. Pre-Requisite: Event Service is supported by the DUT. Test Configuration: ONVIF Client and DUT Test Procedure: Start an ONVIF Client. Start the DUT. ONVIF Client will invoke Subscribe request to instantiate a Subscription Manager. The Subscribe request does not contain a TopicExpression or a Message Content Filter. The Message contains an InitialTerminationTime of 10s to ensure that the Subscription is terminated after end of this test. Verify that the DUT sends SubscribeResponse message. Verify that a valid SubscriptionReference is returned (valid EndpointReference); verify that valid values for CurrentTime and TerminationTime are returned (TerminationTime >= CurrentTime + InitialTerminationTime). Test Result: PASS – DUT passes all assertions. FAIL – The DUT did not send SubscribeResponse message. The DUT did not return a valid SubscriptionReference. The DUT did not return valid values for CurrentTime and TerminationTime. The DUT did not send valid WS-Addressing Action URI in SOAP Header for SubscribeResponse message (see [Annex A.3](file:///D:/New Folder/Docs/Specifications/EVENT.html#Annex_ActionURIsForEventServiceMessages)). Note: The Subscription Manager has to be deleted at the end of the test either by calling unsubscribe or through a timeout. Note: If the DUT cannot accept the set value to an InitialTerminationTime, ONVIF Client retries to send the Subscribe request with MinimumTime value included in UnacceptableInitialTerminationTimeFault. ——请根据代码分析原因(其他接口都正常只有事件订阅出问题是不是只能是soap_event.c/soap_tev.c的问题?),能不能分析出问题具体是哪个函数/哪部分代码引起的?如果不能分析出具体原因的请给出调试方法(包括应该在什么地方添加log等等)
10-23
基于可靠性评估序贯蒙特卡洛模拟法的配电网可靠性评估研究(Matlab代码实现)内容概要:本文围绕“基于可靠性评估序贯蒙特卡洛模拟法的配电网可靠性评估研究”,介绍了利用Matlab代码实现配电网可靠性的仿真分析方法。重点采用序贯蒙特卡洛模拟法对配电网进行长时间段的状态抽样与统计,通过模拟系统元件的故障与修复过程,评估配电网的关键可靠性指标,如系统停电频率、停电持续时间、负荷点可靠性等。该方法能够有效处理复杂网络结构与设备时序特性,提升评估精度,适用于含分布式电源、电动汽车等新型负荷接入的现代配电网。文中提供了完整的Matlab实现代码与案例分析,便于复现和扩展应用。; 适合人群:具备电力系统基础知识和Matlab编程能力的高校研究生、科研人员及电力行业技术人员,尤其适合从事配电网规划、运行与可靠性分析相关工作的人员; 使用场景及目标:①掌握序贯蒙特卡洛模拟法在电力系统可靠性评估中的基本原理与实现流程;②学习如何通过Matlab构建配电网仿真模型并进行状态转移模拟;③应用于含新能源接入的复杂配电网可靠性定量评估与优化设计; 阅读建议:建议结合文中提供的Matlab代码逐段调试运行,理解状态抽样、故障判断、修复逻辑及指标统计的具体实现方式,同时可扩展至不同网络结构或加入更多不确定性因素进行深化研究。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值