1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.panels.request.components;
14
15 import java.beans.PropertyChangeEvent;
16 import java.beans.PropertyChangeListener;
17
18 import org.apache.xmlbeans.SchemaTypeSystem;
19 import org.apache.xmlbeans.XmlBeans;
20
21 import com.eviware.soapui.SoapUI;
22 import com.eviware.soapui.impl.wsdl.WsdlInterface;
23 import com.eviware.soapui.impl.wsdl.WsdlRequest;
24 import com.eviware.soapui.impl.wsdl.panels.request.components.editor.support.AbstractXmlDocument;
25 import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext;
26
27 /***
28 * XmlDocument for a WsdlRequest
29 *
30 * @author ole.matzura
31 */
32
33 public class RequestXmlDocument extends AbstractXmlDocument implements PropertyChangeListener
34 {
35 private final WsdlRequest request;
36 private boolean updating;
37
38 public RequestXmlDocument(WsdlRequest request)
39 {
40 this.request = request;
41 request.addPropertyChangeListener( WsdlRequest.REQUEST_PROPERTY, this );
42 }
43
44 public String getXml()
45 {
46 return request.getRequestContent();
47 }
48
49 public void setXml(String xml)
50 {
51 request.setRequestContent( xml );
52 }
53
54 public void propertyChange(PropertyChangeEvent evt)
55 {
56 if( !updating )
57 fireXmlChanged( (String)evt.getOldValue(), (String)evt.getNewValue() );
58 }
59
60 public SchemaTypeSystem getTypeSystem()
61 {
62 WsdlInterface iface = (WsdlInterface) request.getOperation().getInterface();
63 WsdlContext wsdlContext = iface.getWsdlContext();
64 try
65 {
66 return wsdlContext.getSchemaTypeSystem();
67 }
68 catch (Exception e1)
69 {
70 SoapUI.logError( e1 );
71 return XmlBeans.getBuiltinTypeSystem();
72 }
73 }
74
75 public void release()
76 {
77 request.removePropertyChangeListener( WsdlRequest.REQUEST_PROPERTY, this );
78 }
79 }