Hi Sai Teja,
PFB the code I am using for mocking the userlist creation:
//Calling Program with endpoint set to localhost so that google ads API
will not be called for testing
val session = new AdWordsSession.Builder()
.withClientCustomerId("123-456-7891")
.withDeveloperToken("AWEDEEDDDDDTREWQSDFGYTR")
.withEndpoint("https://localhost:8444")
.withUserAgent("foo")
.withOAuth2Credential(credential).build()
GoogleUtils.createNewAudienceList("newlist", "new_email_list", session)
//Creates audience List
def createNewAudienceList(audienceListName: String, audienceListDescription:
String,session:AdWordsSession ): Unit = {
val userListService: AdwordsUserListServiceInterface =
adWordsServices.get(session, classOf[AdwordsUserListServiceInterface])
//Create a new UserList
val userList = new CrmBasedUserList()
userList.setDescription(audienceListDescription)
if (audienceListDescription.toUpperCase().contains("EMAIL")) {
val uploadKeyType = CustomerMatchUploadKeyType.CONTACT_INFO
userList.setUploadKeyType(uploadKeyType)
userList.setName(audienceListName+"_Email")
userList.setMembershipLifeSpan(10000L)
}
else {
val uploadKeyType = CustomerMatchUploadKeyType.MOBILE_ADVERTISING_ID
userList.setUploadKeyType(uploadKeyType)
userList.setName(audienceListName+"_Maid")
userList.setAppId(appId)
userList.setMembershipLifeSpan(540L)
}
//Upload the newly created userlist in GoogleAds page using mutate operation
val operation = new UserListOperation()
operation.setOperand(userList)
operation.setOperator(Operator.ADD)
val result = userListService.mutate(Array(operation))
}
*//Wiremock Server to intercept localhost calls*
System.setProperty("javax.net.ssl.trustStore", System.getProperty("trustStore"))
private val wireMockServer = new
WireMockServer(wireMockConfig().port(8080).httpsPort(8444).keystorePath(System.getProperty("trustStore")))
WireMock.configureFor("localhost", 8080)
wireMockServer.start()
*Whole Log:*
*19/04/30 18:35:33 INFO Log4jNotifier: Request received:
POST /api/adwords/rm/v201809/AdwordsUserListService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:8444
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1555
Authorization: Bearer null
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><ns1:RequestHeader
soapenv:mustUnderstand="0"
xmlns:ns1="https://adwords.google.com/api/adwords/rm/v201809"><ns2:clientCustomerId
xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">123-456-7891</ns2:clientCustomerId><ns3:developerToken
xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201809">AWEDEEDDDDDTREWQSDFGYTR</ns3:developerToken><ns4:userAgent
xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201809">foo (AwApi-Java,
AdWords-Axis/4.4.0, Common-Java/4.4.0, Axis/1.4, Java/1.8.0_201,
maven)</ns4:userAgent><ns5:validateOnly
xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201809">false</ns5:validateOnly><ns6:partialFailure
xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201809">false</ns6:partialFailure></ns1:RequestHeader></soapenv:Header><soapenv:Body><mutate
xmlns="https://adwords.google.com/api/adwords/rm/v201809"><operations><ns7:operator
xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201809">ADD</ns7:operator><operand
xsi:type="ns8:CrmBasedUserList"
xmlns:ns8="https://adwords.google.com/api/adwords/rm/v201809"><ns8:name>newlist_Email</ns8:name><ns8:description>new_email_list</ns8:description><ns8:membershipLifeSpan>10000</ns8:membershipLifeSpan><ns8:uploadKeyType>CONTACT_INFO</ns8:uploadKeyType></operand></operations></mutate></soapenv:Body></soapenv:Envelope>
19/04/30 18:35:33 ERROR SOAPPart: Exception:
java.lang.NullPointerException
java.lang.NullPointerException
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:453)
at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:559)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:322)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
at org.apache.axis.Message.writeTo(Message.java:539)
at
com.google.api.ads.common.lib.soap.ResponseInfoXPathSet.parseMessage(ResponseInfoXPathSet.java:76)
at
com.google.api.ads.common.lib.soap.axis.AxisHandler.invokeSoapCall(AxisHandler.java:249)
- should throw exceptions when Google generation of Custom Audience ID Fails
*** FAILED ***
java.lang.NullPointerException:
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:324)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
at org.apache.axis.Message.writeTo(Message.java:539)
at
com.google.api.ads.common.lib.soap.ResponseInfoXPathSet.parseMessage(ResponseInfoXPathSet.java:76)
at
com.google.api.ads.common.lib.soap.axis.AxisHandler.invokeSoapCall(AxisHandler.java:249)
at
com.google.api.ads.common.lib.soap.SoapServiceClient.callSoapClient(SoapServiceClient.java:63)
at
com.google.api.ads.common.lib.soap.SoapServiceClient.invoke(SoapServiceClient.java:93)
at com.sun.proxy.$Proxy37.mutate(Unknown Source)
at
com.google.api.ads.common.lib.soap.SoapServiceClient.callSoapClient(SoapServiceClient.java:63)
at
com.google.api.ads.common.lib.soap.SoapServiceClient.invoke(SoapServiceClient.java:93)
at com.sun.proxy.$Proxy37.mutate(Unknown Source)
at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
at org.scalatest.Transformer.apply(Transformer.scala:22)
at org.scalatest.Transformer.apply(Transformer.scala:20)
at org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1682)
at org.scalatest.TestSuite$class.withFixture(TestSuite.scala:196)
at org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1685)
at
org.scalatest.FlatSpecLike$class.invokeWithFixture$1(FlatSpecLike.scala:1679)
at
org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1692)
at
org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1692)
at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
at org.scalatest.FlatSpecLike$class.runTest(FlatSpecLike.scala:1692)
at
arrow.SyndicateToGoogleTest.org$scalatest$BeforeAndAfter$$super$runTest(SyndicateToGoogleTest.scala:19)
at org.scalatest.BeforeAndAfter$class.runTest(BeforeAndAfter.scala:203)
at arrow.SyndicateToGoogleTest.runTest(SyndicateToGoogleTest.scala:19)
at
org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1750)
at
org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1750)
at
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:396)
at
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
at
org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:373)
at
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:410)
at
org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
at
org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:379)
at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
at org.scalatest.FlatSpecLike$class.runTests(FlatSpecLike.scala:1750)
at org.scalatest.FlatSpec.runTests(FlatSpec.scala:1685)
at org.scalatest.Suite$class.run(Suite.scala:1147)
at
org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1685)
at
org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1795)
at
org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1795)
at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
at org.scalatest.FlatSpecLike$class.run(FlatSpecLike.scala:1795)
at
arrow.SyndicateToGoogleTest.org$scalatest$BeforeAndAfter$$super$run(SyndicateToGoogleTest.scala:19)
at org.scalatest.BeforeAndAfter$class.run(BeforeAndAfter.scala:258)
at arrow.SyndicateToGoogleTest.run(SyndicateToGoogleTest.scala:19)
at org.scalatest.Suite$class.callExecuteOnSuite$1(Suite.scala:1210)
at
org.scalatest.Suite$$anonfun$runNestedSuites$1.apply(Suite.scala:1257)
at
org.scalatest.Suite$$anonfun$runNestedSuites$1.apply(Suite.scala:1255)
at
scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at org.scalatest.Suite$class.runNestedSuites(Suite.scala:1255)
at
org.scalatest.tools.DiscoverySuite.runNestedSuites(DiscoverySuite.scala:30)
at org.scalatest.Suite$class.run(Suite.scala:1144)
at org.scalatest.tools.DiscoverySuite.run(DiscoverySuite.scala:30)
at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
at
org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1346)
at
org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$1.apply(Runner.scala:1340)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1340)
at
org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1011)
at
org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1010)*
*Thanks*
On Wednesday, May 1, 2019 at 1:44:27 AM UTC+5:30, googleadsapi-forumadvisor
wrote:
>
> Hello Warner,
>
> Your SOAP request seems to be good. It is not possible to mock the
> UserList creation and updating users. Could you please share the complete
> logs and the scenario you are trying to achieve to investigate further?
>
> Regards,
> Sai Teja, Google Ads API Team
>
>
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
> Also find us on our blog and discussion group:
> https://ads-developers.googleblog.com/search/label/google_ads_api
> https://developers.google.com/adwords/api/community/
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>
> Was your question answered? Please rate your experience with us by taking
> a short survey.
> If not -- reply to this email and tell us what else we can do to help.
>
> Take Survey
> <https://support.google.com/google-ads/contact/survey_transactional?caseid=7-4165000026277&hl=en&ctx=1>
>
> Also find us on our blog and discussion group:
> http://googleadsdeveloper.blogspot.com/search/label/adwords_api
> https://developers.google.com/adwords/api/community/
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/e413f25f-0964-4097-bb99-1bf22f9a8a63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.