1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.support;
14
15 import javax.wsdl.BindingOperation;
16 import javax.wsdl.Part;
17
18 import org.apache.xmlbeans.SchemaType;
19 import org.apache.xmlbeans.XmlCursor;
20 import org.apache.xmlbeans.XmlObject;
21
22 import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlUtils;
23
24 /***
25 * Wrapper for WSDL parts
26 *
27 * @author ole.matzura
28 */
29
30 public class MessageXmlPart
31 {
32 private XmlObject partXmlObject;
33 private final XmlObject sourceXmlObject;
34 private final Part part;
35 private final BindingOperation bindingOperation;
36 private final boolean isRequest;
37 private final SchemaType type;
38
39 public MessageXmlPart( XmlObject sourceXmlObject, SchemaType type, Part part, BindingOperation bindingOperation,
40 boolean isRequest )
41 {
42 this.sourceXmlObject = sourceXmlObject;
43 this.type = type;
44 this.part = part;
45 this.bindingOperation = bindingOperation;
46 this.isRequest = isRequest;
47 partXmlObject = type == null ? sourceXmlObject.copy() : sourceXmlObject.copy().changeType( type );
48 }
49
50 public void update()
51 {
52 sourceXmlObject.set( partXmlObject );
53 }
54
55 public XmlCursor newCursor()
56 {
57 return partXmlObject.newCursor();
58 }
59
60 public boolean isAttachmentPart()
61 {
62 return isRequest ? WsdlUtils.isAttachmentInputPart( part, bindingOperation ) : WsdlUtils.isAttachmentOutputPart(
63 part, bindingOperation );
64 }
65
66 public Part getPart()
67 {
68 return part;
69 }
70
71 public SchemaType getSchemaType()
72 {
73 return type;
74 }
75 }