001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.soap; 014 015import org.apache.juneau.*; 016import org.apache.juneau.serializer.*; 017import org.apache.juneau.xml.*; 018 019/** 020 * Serializes POJOs to HTTP responses as XML+SOAP. 021 * 022 * <h5 class='topic'>Media types</h5> 023 * 024 * Handles <code>Accept</code> types: <code><b>text/xml+soap</b></code> 025 * <p> 026 * Produces <code>Content-Type</code> types: <code><b>text/xml+soap</b></code> 027 * 028 * <h5 class='topic'>Description</h5> 029 * 030 * Essentially the same output as {@link XmlDocSerializer}, except wrapped in a standard SOAP envelope. 031 */ 032public final class SoapXmlSerializer extends XmlSerializer { 033 034 //------------------------------------------------------------------------------------------------------------------- 035 // Configurable properties 036 //------------------------------------------------------------------------------------------------------------------- 037 038 private static final String PREFIX = "SoapXmlSerializer."; 039 040 /** 041 * Configuration property: The <code>SOAPAction</code> HTTP header value to set on responses. 042 * 043 * <h5 class='section'>Property:</h5> 044 * <ul> 045 * <li><b>Name:</b> <js>"SoapXmlSerializer.SOAPAction.s"</js> 046 * <li><b>Data type:</b> <code>String</code> 047 * <li><b>Default:</b> <js>"http://www.w3.org/2003/05/soap-envelope"</js> 048 * <li><b>Methods:</b> 049 * <ul> 050 * <li class='jm'>{@link SoapXmlSerializerBuilder#soapAction(String)} 051 * </ul> 052 * </ul> 053 */ 054 public static final String SOAPXML_SOAPAction = PREFIX + "SOAPAction.s"; 055 056 057 //------------------------------------------------------------------------------------------------------------------- 058 // Instance 059 //------------------------------------------------------------------------------------------------------------------- 060 061 final String soapAction; 062 063 /** 064 * Constructor. 065 * 066 * @param ps The property store containing all the settings for this object. 067 */ 068 public SoapXmlSerializer(PropertyStore ps) { 069 super(ps, "text/xml", "text/xml+soap"); 070 soapAction = getStringProperty(SOAPXML_SOAPAction, "http://www.w3.org/2003/05/soap-envelope"); 071 } 072 073 @Override /* Serializer */ 074 public WriterSerializerSession createSession(SerializerSessionArgs args) { 075 return new SoapXmlSerializerSession(this, args); 076 } 077}